in reply to Regex prob with interpolated patterns
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.$string = 'string with word foo in it'; $find = '(foo)'; $replace = '"${1}bar"'; $string =~ s/$find/$replace/eeg;
|
|---|