http://www.perlmonks.org?node_id=1007072


in reply to "ee" in Regular Expression: version issue?

$var =~ s/$lhs/$rhs/ee;
means
$var =~ s/$lhs/eval $rhs/e;
(Except that exceptions aren't caught.)

That means $rhs must contain valid Perl code, yet $1$2$3 is not valid Perl code. "$1$2$3" or $1.$2.$3 would be valid Perl code, so you want

$rhs = '"$1$2$3"';
or
$rhs = '$1.$2.$3';