A
adam
The following program doesn't do what I expected. The second and third
"print" statements print, but the first one doesn't. It looks as
though when the match operator uses a regular expression constructed
with qr//, the "m" modified that should have been stored in the regular
expression is ignored. Did I do something wrong, or is this a bug in
Perl? perl -v says 5.005_03.
-- thanks, Adam
$pat = "a\$";
$re = qr/$pat/m;
$s = "a\nb";
print "Matches with qr\n" if $s =~ /$re/;
print "Matches without qr\n" if $s =~ /$pat/m;
print "Matches with qr and m flag\n" if $s =~ /$re/m;
"print" statements print, but the first one doesn't. It looks as
though when the match operator uses a regular expression constructed
with qr//, the "m" modified that should have been stored in the regular
expression is ignored. Did I do something wrong, or is this a bug in
Perl? perl -v says 5.005_03.
-- thanks, Adam
$pat = "a\$";
$re = qr/$pat/m;
$s = "a\nb";
print "Matches with qr\n" if $s =~ /$re/;
print "Matches without qr\n" if $s =~ /$pat/m;
print "Matches with qr and m flag\n" if $s =~ /$re/m;