in reply to Re: On the regex pattern variable to be inserted into another
in thread On the regex pattern variable to be inserted into another
I expect m/$foo/ to "recompile" because it could also be m/$foo$bar/
The point of qr is that the inside of $foo=qr// is not effected.
If you don't want it to be recompiled use $str =~ $foo without surrounding m/.../
Your problem seems to arise from the /g "global" switch which is actually changing the whole m operator and not the regex.
Please note that the documentation for qr/STRING/msixpodualn doesn't list /g !
It might help to know that m// and m//g are realized as separate commands in other languages.°
°) e.g. in JS
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: On the regex pattern variable to be inserted into another
by NERDVANA (Priest) on Feb 10, 2022 at 18:03 UTC | |
by LanX (Saint) on Feb 10, 2022 at 19:14 UTC | |
by LanX (Saint) on Feb 10, 2022 at 21:18 UTC | |
by NERDVANA (Priest) on Feb 11, 2022 at 13:39 UTC | |
by hv (Prior) on Feb 11, 2022 at 18:59 UTC |