I have a file which contains two columns. Column 1 is the pattern to match, column 2 contains the replacement pattern.
So:
i want to do substitution using the interpolated varabiles in my code. I can get the pattern to match just fine, but when i place the second part in the replacment string, Perl interpolates the variable the string is contained in, but it does not interpolate the $1, $2, $3 variables within that string.
The print statement always prints "B$1_Y$2_M$3", not the values that should be stored in the $1, $2, and $3 variables.
Anyone know what I'm doing wrong? Thanks!
So:
Code:
B_(Stopp)_(\d{4})(\d{2})\d{2} B$1_Y$2_M$3
Code:
$line =~ s/$changes{$oldname}/$changes{$newname}/g;
print $line;
exit;
The print statement always prints "B$1_Y$2_M$3", not the values that should be stored in the $1, $2, and $3 variables.
Anyone know what I'm doing wrong? Thanks!