sub late_mod { my ($string, $pattern) = @_; my $regex = qr/$pattern/; return ($string =~ /$regex/s); # <= 's' modifier }
If you print out $regex after it has been compiled:
$ perl -le' my $pattern = q/fox.+?jumps/; my $regex = qr/$pattern/; print $regex; ' (?-xism:fox.+?jumps)
You will see that because there was no /s option when using qr// that it is turned off for this compiled regular expression.
In reply to Re: Pattern matching with qr// and modifiers
by jwkrahn
in thread Pattern matching with qr// and modifiers
by Athanasius
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |