in reply to substitution interpolation?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: substitution interpolation?
by sierrathedog04 (Hermit) on May 31, 2001 at 13:46 UTC |