The documentation for the /m
option in perlre says this:
Treat string as multiple lines. That is, change "^" and "$" from matching the start or end of the string to matching the start or end of any line anywhere within the string.
But this example seems to indicate that /^/
and /^/m
behave the same way. What am I misunderstanding?
use strict;
no warnings; # Ignore warning about implicit split to @_
my $x = " \n \n ";
print scalar(split /^/m, $x), scalar(split /$/m, $x), "\n"; # 33
print scalar(split /^/, $x), scalar(split /$/, $x), "\n"; # 31