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)*/;
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Using string literal in regexp
by davorg
in thread Using string literal in regexp
by tomazos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |