|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re: Meaning of /o in Regexesby cjf-II (Monk) |
| on Dec 06, 2002 at 12:30 UTC ( #218049=note: print w/ replies, xml ) | Need Help?? |
|
The /o modifier is used when you only want the pattern compiled once. So in the second pattern, $x will not be incremented and as such, only matches once. Update: Okay, I promise to read the questions in full before replying from now on (and this time I mean it! ;-). So to answer your actual question... The difference between qr// and the /o modifier as I understand it is that with /o you can never change the pattern, whereas with qr// you can compile the pattern to be used as part of a larger regex. As the good book shows:
I Hope that's slightly more helpful :).
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||