Given the following code snippet:
---------------------------------
print "$text\n";
my $text="sour red apples";
my $pattern="(sour)";
my $replacement="very \$1";
$text=~s/$pattern/$replacement/;
print "$text\n";
---------------------------------
I was expecting "very sour red apples" to be printed, but instead I got
"very $1 red apples". I tried changing:
$text=~s/$pattern/$replacement/;
to
$text=~s/$pattern/$replacement/ee;
but that did not work either. How can I make it work, so that it was as if
I had written:
$test=~s/$pattern/very $1/; # With the "very $1" being extracted from the
#$replacement variable
Thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]