'm' is for if you want the regexp to evaluate each line in a string:
Code:
my $string = q~mary had a little lamb
it's fleece was white as snow
everywhere that mary went
the lamb was sure to go~;
$string =~ s/^/foo/mg;
print $string;
prints:
foomary had a little lamb fooit's fleece was white as snow fooeverywhere that marry went foothe lamb was sure to go
's' treats the entire string as one line:
Code:
my $string = q~mary had a little lamb
it's fleece was white as snow
everywhere that marry went
the lamb was sure to go~;
$string =~ s/^/foo/sg;
print $string;
prints:
foomary had a little lamb
it's fleece was white as snow
everywhere that marry went
the lamb was sure to go
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.