in reply to Basic regex question

quotemeta (from perlfunc) or \Q (from perlre) (they are the same thing just used in different places):
$string = quotemeta('$foo'); /^$string/; # Or $string = '$foo'; /\Q$string/;