P is for Practical | |
PerlMonks |
Re^4: Regexp substitution using variablesby LanX (Saint) |
on Nov 26, 2020 at 11:51 UTC ( [id://11124259]=note: print w/replies, xml ) | Need Help?? |
Though ... there is one "lighter" version to build your replacement dynamically. eval the replacement-string into a sub, and apply just one /e at the s///
This will give you more control about what is happening, since you can use B::Deparse to check the replacement string before executing it. Like this you have at least a chance to reject dubious code.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|