Citeren Ricardo SIGNES <perl.p5p@rjbs.manxome.org>:
>
> I forgot about how dramatically more useful qr{} became once qr{}m worked
> properly, as demonstrated by this code:
>
> use strict;
> use Test::More 'no_plan';
>
> my $string = "Subject: Hello Jimbo Johnson\x0ADate: whatever";
>
> like($string, '/(?m:^Subject: Hello Jimbo Johnson$)/', "q{//}",);
> like($string, qr{(?m:^Subject: Hello Jimbo Johnson$)}, "qr{(?m:...)}",);
> like($string, qr{^Subject: Hello Jimbo Johnson$}m, "qr{}m",);
>
> This was fixed in 5.010, but it looks like the fix made it back into 5.8.9
> (which is great!) but was not documented, going by
> http://perldoc.perl.org/5.8.9/perldelta.html
I hope it isn't fixed in 5.8.9 since it is not backwards compatible.
(As in, it behaves differently.)
> Am I mistaken, or is this an omission to fix in some mythical 5.8.10?
There does seem to be a different in behaviour between 5.8.8 and 5.8.9
but note that it does not behave the same as 5.10.0.
The following prints "not ok" on 5.8.8/5.8.9 and "ok" on 5.10.0 (the
behaviour in 5.10.0 is the 'correct' one):
my $string = "Subject: Hello Jimbo Johnson\x0ADate: whatever";
my $re = qr{^Subject: Hello Jimbo Johnson$}; # no /m
print $string !~ /$re/m ? "ok" : "not ok"; # shouldn't match since
$re didn't had /m
Thread Previous
|
Thread Next