in reply to Expression evaluation in search and replace regex
The /e modifier says to treat the right-hand side of the substitution as an expression. But $1$fruitcolors{$2}$3 isn't a valid Perl expression. To make it valid, add string concatenation operators, as follows: s/(apple)(banana)(chocolate)/$1 . $fruitcolors{$2} . $3/ie;
|
|---|