I don't know if you have the liberty of reformulating the contents of $sub, but if instead of '$1 spooge' maybe you can use '$1.q{ spooge}' and from there you can employ the /ee switch and gain major Perl purity points!
my $var = "my dog spot"; my $expr = "(my (dog|cat)) spot"; my $sub = '$1.q{ spooge}'; $var =~ s/$expr/$sub/ee; print $var;
In reply to Re: substitution interpolation?
by grinder
in thread substitution interpolation?
by h0mee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |