P is for Practical | |
PerlMonks |
Re^3: Precompiling qr/.../o questionby hardburn (Abbot) |
on Apr 02, 2008 at 19:11 UTC ( [id://678026]=note: print w/replies, xml ) | Need Help?? |
Sure, it technically works (probably because /o gets dragged along into qr// like any other regex option list), but it's still redundant and confusing. The problem with /o is when you start with something harmless like this:
Then later you realize you need to add a loop variable to the regex:
Which results in the regex checking against '1' instead of the current loop var. This is almost never what you want, and has caused new and experienced programmers alike to waste many hours of debugging. That's why qr// was invented to Do the Right Thing. "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
In Section
Seekers of Perl Wisdom
|
|