in reply to Regex prob with interpolated patterns

  1. You shouldn't use \1 on the RHS of s///, you should be using $1. \1 is used in LHS of s/// in the regex itself.
  2. Take a look at the /e modifier for s///. Your code will look something like this:
$string = 'string with word foo in it'; $find = '(foo)'; $replace = '"${1}bar"'; $string =~ s/$find/$replace/eeg;
Note the double quotes in $replace and the /ee on the s///. The first e causes $replace to be evaluated, which returns "${1}bar" which is then evaluated by the second e which returns foobar.