Perl: the Markov chain saw | |
PerlMonks |
Re^3: 'g' flag w/ 'qr'by Athanasius (Archbishop) |
on May 29, 2016 at 09:29 UTC ( [id://1164436]=note: print w/replies, xml ) | Need Help?? |
I’m guessing you’re running a fairly old version of Perl? On 5.20.2, I get:
— which is clear. But on 5.12.3, I get:
— which isn’t. In any case, the “deprecated” message you’re seeing is related only indirectly to the presence of a /g modifier on a qr// term. The Perl compiler is simply confused as to what the syntax is supposed to mean, and its (incorrect) guess leads it to find a construct which you never intended and which happens to be deprecated. Actually, the qr// syntax was introduced in Perl 5.005,1 which was released in 1998. The first edition of the Camel Book to document qr// was the third edition, published in July, 2000 (4 months after the release of Perl 5.6). The section “Pattern-Matching Operators” in Chapter 5 draws a distinction between those modifiers which apply to a regex (are are therefore applicable to qr//) and those which apply to an operator (and are therefore applicable only to m// and s///).2 The /g modifier falls in the second category. So, AFAICT, putting a /g modifier on a qr// term is not “deprecated,” as it was never allowed in the first place. 1Update (May 30, 2016): See perl5005delta#New qr// operator. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|