Multiline replace perl
What if we want to replace something accross multiple lines easily.
Most of the time people will get stuck with the /m /g parameter but sometimes it’s not enough.
And here comes the /s parameter.
The /s parameter allows to consider new line as any other letter. Otherwise you will have to create a more complex regexp that include new line.
So to replace somthing inside html (multiple line) just use this modifier:
$html =~ s/(<head>.*?<\/head>)/$newhead/sgmi;
and it’s done.


