try "bar$1"?
update:
Won't give an error but doesn't work...
I assume you need the outpur
blah barfoo blah
like the regex:
s/(foo)/bar$1/does...
this created
foo bar blah...
weird thing is that the parentheses are evaluated correctly in the regex: this works:
my $regex = ['(foo)','bar'];
$string =~ s/$regex->[0]/$regex->[1]$1/;
update2:
dave_the_m was quicker and right, it's
#!/usr/bin/perl
use strict;
my $regex = ['(foo)', '"bar$1"' ];
my $string = 'blah foo blah';
$string =~ s/$regex->[0]/$regex->[1]/ee;
print "$string\n";
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.