http://qs1969.pair.com?node_id=555824

tomazos has asked for the wisdom of the Perl Monks concerning the following question:

I have a scalar string..

my $foo = '$@!#@#$^$#@^';

..and I want to incorporate it into a regular expression such that the characters of the string will be matched literally, no matter what characters they are.

ie

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

What is the correct way to interpolate a string literal into a regular expression?

Thanks,

-Andrew.