in reply to Evaluating $1 construct in literal replacement expression
How about:
my $s ; s/$search/$subst/g and $s = $1 and s/\$1/$s/g ; [download]