$b = quotemeta $b; $a =~ s/$b/$c/g; #or $a =~ s/\Q$b/$c/g; # \E not needed at end of pattern