$_='Some string with $foo and bar'; $bar='bar'; $foo='$bar'; /$bar/ and print "$&\n"; /$foo/ and print "$&\n"; /\Q$fooE/ and print "$&\n"; s/\Q$fooE/XYZ/; print "$_\n";