in reply to Regular Expressions and Variables

You want to use the \Q...\E escape around the variable in the LHS of your regex (or use quotemeta() on it) to stop Perl from treating it like a regex.
$from = '[hello]'; $to = '{goodbye}'; $string =~ s/\Q$from\E/$to/; # or $safe_from = quotemeta $from; $string =~ s/$safe_from/$to/;


japhy -- Perl and Regex Hacker