On Dec 22, 2007 6:35 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > On Dec 21, 2007 12:08 PM, demerphq <demerphq@gmail.com> wrote: > > No it wont actually. The warning would only be raised when the $qr > > variable is the only thing in the pattern. The diagnostics should read > > (added an 'only'): > > > > +(W regexp) Your pattern contains only a variable containing a precompiled > > +regular expression pattern whose behavior will not be changed by the > > +pattern modifiers provided. > > > > $qr=/^foo/; > > $x=~/$qr/m; # warns; > > $x=~/$qr|foo/m; #does not warn > > $x=~/$qr/x; # does not warn (/x doesnt change match semantics) > > In the current implementation yes, but we might potentially want to > warn in the future on useless modifiers in general, eg: > > $x =~ /(?-msix:^foo)/msi; That would be hilarious as it'd presumably throw warnings at people who uselessly used the /msx modifiers as suggested by Damian's PBP. Mostly I find uselessly adding /msx makes it harder to read code because I have to guess more about intent and it's noise. I'd be all for this sort of warning. JoshThread Previous | Thread Next