The escape sequence \Q ...\E quotes, or protects most non-alphabetic characters. For instance,
1. $x = "\QThat !^*&%~& cat!";
2. $x =~ /\Q!^*&%~&\E/; # check for rough language
It does not protect $ or @ , so that variables can still be substituted.
####
use warnings;
use strict;
print "Yes!\n" if ( '$@' =~ m|\$\@| );
# prints "Yes!"
####
use warnings;
use strict;
my $string = '@@@';
if ( $string =~ m|\$\@| ){
print "Yes!\n";
}
else {
print "\'$string\' did not match...\n";
}
# prints "'@@@' did not match..."