Do it this way
tachyon
my $var = "my dog spot"; my $expr = "(my dog) spot"; $var =~ m/$expr/; my $sub = "$1 spooge"; $var =~ s/$expr/$sub/; print $var;
By matching first we define $1. When we define $sub $1 is interpolated into the string. We then do the substitution with the replacement string fully formed, and ta da - it works
Cheers
In reply to Re: substitution interpolation?
by tachyon
in thread substitution interpolation?
by h0mee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |