but that is cumbersome for the user
Presuming the code will end up in a script,
perl -s -e "$data='abcdef'; $data=~s#$r#qq{$s}#ee; print $data" -- -r= +(abc) -s=$1hello
Note that the caller is able to execute arbitrary code, but that goes in hand in hand with what you asked. You'd need some kind of template system to be safe. (Upd: An anonymous monk has provided some.)
In reply to Re: reinterpolation of regexp (and strings?)
by ikegami
in thread reinterpolation of regexp (and strings?)
by AlwaysLearning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |