szabgab has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; my $str = "x\nab\ny"; my $re = '^ab$'; print $str =~ /$re/ ? 1 : 0, "\n"; # 0 print $str =~ /$re/m ? 1 : 0, "\n"; # 1 my $qre = qr/^ab$/; print $str =~ /$qre/ ? 1 : 0, "\n"; # 0 print $str =~ /$qre/m ? 1 : 0, "\n"; # 0 but I think 5.8.x still had + this as 1
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: This regex surprised me
by Athanasius (Archbishop) on Aug 13, 2014 at 17:17 UTC | |
Re: This regex surprised me
by AppleFritter (Vicar) on Aug 13, 2014 at 18:45 UTC | |
Re: This regex surprised me
by choroba (Cardinal) on Aug 13, 2014 at 18:32 UTC | |
Re: This regex surprised me ( qr//m, perldeltas, perlcritic )
by Anonymous Monk on Aug 13, 2014 at 21:34 UTC |