Possible Duplicate:
How to use a variable in the replacement side of the Perl substitution operator?
I would like to do something like
$sub = "\\1";
$match = "hi(.*)";
$str = "hi1234"
$res = $str;
$res =~ s/$match/$sub/g
I would like this to return 1234
but in this case it returns \1
. I.e. I want it to be equivalent to s/$match/\1/g
does anyone know how to do this?