Tanktalus has asked for the wisdom of the Perl Monks concerning the following question:
Is this supposed to work in 5.8.8?
With 5.8.8, I get, surprisingly:#! perl -l use strict; use warnings; my $s = join '', map {"$_\n"} qw(abc def ghi jkl); my $m = qr/^def$/xms; print "Match? \"$s\" =~ qr/$m/"; print " 1 : ", $s =~ $m ? "YES" : "NO?"; print " 2 : ", $s =~ qr/^def$/xms ? "YES" : "NO?"; print " 3 : ", $s =~ qr/def/xms ? "YES" : "NO?";
With 5.12.2, I get all YES. Either it's a bug that was fixed in newer perls, or I'm severely confused. Anyone can shed some light?$ perl5.8.8 sq.pl Match? "abc def ghi jkl " =~ qr/(?msx-i:^def$)/ 1 : NO? 2 : NO? 3 : YES
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex /m flag
by ikegami (Patriarch) on Nov 09, 2010 at 17:03 UTC | |
|
Re: regex /m flag
by kennethk (Abbot) on Nov 09, 2010 at 17:02 UTC | |
|
Re: regex /m flag
by JavaFan (Canon) on Nov 09, 2010 at 16:38 UTC | |
by Anonymous Monk on Nov 10, 2010 at 00:51 UTC |