in reply to Regex Error

I think you want \Q and \E:

#!/usr/bin/perl use strict; my $cur = "\$foo"; my $after = "This is a \$foo test"; print "Match: '$after' contains '$cur'\n" if ($after =~ /\Q$cur\E/);