Don't ask to ask, just ask | |
PerlMonks |
Re: Regexp substitution using variablesby choroba (Cardinal) |
on Nov 25, 2020 at 19:56 UTC ( [id://11124222]=note: print w/replies, xml ) | Need Help?? |
Some of the flags can be moved to a non-capturing group:
But you can't do that for /gore. Update: Even string eval doesn't help, as plain interpolation of the $replacement can break if it contains a slash. doesn't work either, as you can't put $1 into $replacement unless you always use /ee which makes it unsafe again.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|