in reply to Interpolating backreferences in an eval
use String::Interpolate qw( ); sub expand { my ($rx, $from, $to) = @_; if ($from =~ $rx) { my $t = String::Interpolate->new(); $t->($to); $t->([ map substr($from, $-[$_], $+[$_] - $-[$_]), 1..$#- ]); print "$t\n"; } }
It's close to Perl code ('"a$1$1c"') so you could convert it to Perl code (the step you are missing) and execute it (eval $code), but that's a very bad approach.
|
|---|