% cat x.pl $_ = 'foo'; $lhs = '(.)oo'; $rhs = '\1ar'; eval "s/$lhs/$rhs/"; print "$_\n"; % perl x.pl far %