in reply to Re: Use global flag when declaring regular expressions with qr?
in thread Use global flag when declaring regular expressions with qr?
wouldn't this approach of enclosing it again with /$re/g, as in this case, defeat the purpose of it?
No. $x =~ $y is already short for $x =~ m/$y/, so it doesn't add a penalty. And as per the last line of my answer, it's not stringified and recompiled when the entire pattern is a compiled regex, so the purpose isn't defeated.
As for marking as "solved", you just did :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Use global flag when declaring regular expressions with qr?
by choroba (Cardinal) on Oct 28, 2024 at 18:23 UTC | |
|
Re^3: Use global flag when declaring regular expressions with qr?
by unmatched (Sexton) on Oct 28, 2024 at 15:20 UTC |