P is for Practical | |
PerlMonks |
Re: 'g' flag w/ 'qr'by Athanasius (Archbishop) |
on May 29, 2016 at 03:05 UTC ( [id://1164427]=note: print w/replies, xml ) | Need Help?? |
Hello perl-diddler, If you look at the documentation for qr//, you’ll see that the /g modifier is not supported: qr/STRING/msixpodualn Which makes sense: qr turns STRING into a regular expression, which may then be used in any number of m{...} and s{...}{...} constructs. The appropriate place to add a /g modifier is at the point of use:
Output:
Update: P.S. - I also just noticed that in addition to stripping out the 'g' option, the 'x' option doesn't seem to work in the regex's parens, i.e. - (?x). I don’t understand what you’re saying here. Can you give some example code? Hope that helps,
In Section
Seekers of Perl Wisdom
|
|