note
JavaFan
<blockquote><em>I find it surprising that adding the modifier back later has no effect, and triggers no warnings. I guess I’ll just have to remember that once a regex has been compiled with qr//, its d, i, m, s, and x settings are thereafter immutable.</em></blockquote>
Well, isn't that the point of having a compiled regexp? Now, if you compile a regexp, you know exactly what you have. Otherwise, if I have a compiled regexp, I still don't know what it does, because modifiers can be applied. It also means that if you would do something like:
<code>
my $pat = gimme_pat(); # Some method returning a qr
if ($str =~ /^ $pat $ # Anchor pattern/x) {
...
}
</code>
will break if <c>$pat</c> uses spaces.
969011
969016