I find it surprising that adding the modifier back later has no effect, and triggers no warnings.
It does have an effect. The effect is on the pattern you add it to though, not on the compiled pattern. The following illustrates what I mean:
$ perl -le '$r = qr/qux./; $s = "qux\n"; print "matches" if $s =~ /$r/ +' $ perl -le '$r = qr/qux./; $s = "quxxx"; print "matches" if $s =~ /$r. +/' matches $ perl -le '$r = qr/qux./; $s = "quxx\n"; print "matches" if $s =~ /$r +./' $ perl -le '$r = qr/qux./; $s = "quxx\n"; print "matches" if $s =~ /$r +./s' matches
In reply to Re^3: Pattern matching with qr// and modifiers
by sauoq
in thread Pattern matching with qr// and modifiers
by Athanasius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |