#!/usr/bin/perl -wT
use strict;
## wrong, causes error
# print "\Qblakem@foo1.com\E\n";
## wrong, prints the backslashes
print quotemeta('blakem@foo2.com'),"\n";
## wrong, still prints backslashes
my $escaped = quotemeta('blakem@foo3.com');
print "$escaped\n";
print $escaped, "\n";
## right
my $email = 'blakem@foo4.com';
print "$email\n";
## right
print "blakem\@foo5.com\n";
print 'blakem@foo6.com',"\n";
=output
blakem\@foo2\.com
blakem\@foo3\.com
blakem\@foo3\.com
blakem@foo4.com
blakem@foo5.com
blakem@foo6.com
####
You cannot include a literal $ or @ within a \Q sequence. An unescaped $ or @ interpolates
the corresponding variable, while escaping will cause the literal string \$ to be inserted.
You'll need to write something like m/\Quser\E\@\Qhost/.
####
print "blakem\@foo.com";
print 'blakem@foo.com';
####
my $email = 'blakem@foo.com';
print $email;