the comments pretty much speak for themselves. <br>i did that so anyone interested can replicate the problem with a cut and paste. <br><br>---- begin ----<br><br>#!/usr/bin/perl -w
<br><br># here's a regexp <br>my $regexp = q{(abcd)(efg)};<br><br># here's a substitution pattern
<br># note the single q{} to block it from interpolating <br>my $suss = q{$2 $1};<br><br># here's a string
<br>my $string = q{abcdefgh};<br><br># run the regexp and putout <br>$string =~ s/$regexp/$suss/;<br>print $string."\n";
<br><br>############################ prints '$2 $1h' <br><br># now try again but hardcode the backreferences in the substitution<br><br>$string = q{abcdefgh};<br>$string =~ s/$regexp/$2 $1/;<br>print $string."\n";
<br>################### prints 'efg abcdh' , as it should<br><br><br>