in reply to Using string literal in regexp

quotemeta or \Q ... \E.

my $bigfoo=quotemeta('aabbaaa$@!#@#$^$#@^bbabaaba'); assert $bigfoo =~ /(a|b)*$foo(a|b)*/;

or

my $bigfoo='aabbaaa$@!#@#$^$#@^bbabaaba'; assert $bigfoo =~ /(a|b)*\Q$foo\E(a|b)*/;
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg