Thanks for your comments. I did read the perldocs a couple of times through before I posted and was aware of the syntax for qr(), including it not supporting the '/g' modifier.
I guess I'm so used to there being "more than one way to do it in perl" that I was baffled when I came across a situation where there wasn't even that one :)
I am aware that I can do it at runtime as in my example. However, what I am attempting to accomplish is to discover a method whereby I can specify a single pattern to:
As you can see in my example, I found a way to do it with a regex, but as it turns out I cannot precompile that regex. And, as this is a snippet from a larger bit of code-- as you might have guessed, I really need for it to be able to be expressed as a single pattern string.
However, from the nature of the replies here, I'm thinking that perhaps the best way is to encode the need for a '/g' modifier into the string (or else something related)-- and then do some quick pre-processing in my code to direct it to execute either with, or without the '/g' modifier.
Thanks all for suggestions and comments. I love coding in perl!
In reply to Re^2: Global Modifier on a Pattern -- HOW!?!?!?
by bratwiz
in thread Global Modifier on a Pattern -- HOW!?!?!?
by bratwiz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |