in reply to Global Modifier on a Pattern -- HOW!?!?!?
The /g modifier doesn't make sense on a precompiled regular expression as it applies to the actions of the matching engine itself, not the pattern. The way to "fix" it is to use the /g at pattern application time:
Or, if you really have a need to dynamicize the global aspect of a pattern match, use strings and eval rather than qr// (somehow I think this isn't what you want though)@matches = $line =~ /$rex/g;
|
|---|