here is a code snippet:
$regex_match = "(.*).txt";
$replacement = "\$1.pdf";
my $new_replacement = ""; #???
my $new_regex_match = quotemeta ($regex_match); #???
$from = "test.txt";
(my $to = $from) =~ s{$regex_match}{$replacement}g;
print "From " . $from . " To " . $to . "\n";
Output : From test.txt To $1.pdf
I believe the $1 is not being interpolated. What needs to change? What does new_replacement and/or new_regex_match be?