And it may not work always. See
'o' modifier clarification needed
____________________________________________________ ** The Third rule of perl club is a statement of fact: pod is sexy. | [reply] |
The original poster had a constant array and the post I was responding to was discussing the benefits of optimizing queries for "once-only" compilation. Obviously if you are wanting to change the array between pattern matches, you'll want to ensure your pattern is current.
Sorry, misreplied.
| [reply] |
| [reply] |
I was just extending the original poster's qr/// suggestion. If you interpolate a variable in a 'qr' string, it "stays" interpolated and will not change if the value of the original variable changes with it, unless you re-create the string for every iteration.
Obviously, if you're going to want to use qr/// or the /o flag on a regex, you are doing so because you wish Perl to compile the regular expression once (at least within the lexical scope of the qr/// string).
| [reply] |
| [reply] |