I use MIME::Lite to send emails from my Perl script. I have use strict; in my header, since that's standard usage in all our scripts.
my $msg = MIME::Lite->new(
From => $from,
To => $to_str,
Cc => $cc_str,
Reply-To => $replyto,
Subject => $tf_subject,
Type => 'multipart/mixed'
);
I get the following error when I add Reply-To in this function to get the bounce back emails.
Bareword "Reply" not allowed while "strict subs" in use at
But I see in the documentation of MIME::Lite that Reply-To is the only way to get the bounce back emails.
Is there a way to accommodate both strict and Reply-To in the same script?
Put Reply-To
in quotes. make it 'Reply-To'
my $msg = MIME::Lite->new(
From => $from,
To => $to_str,
Cc => $cc_str,
'Reply-To' => $replyto,
Subject => $tf_subject,
Type => 'multipart/mixed'
);
Explanation:
The "=>" operator (sometimes pronounced "fat comma") is a synonym for the comma except that it causes a word on its left to be interpreted as a string if it begins with a letter or underscore and is composed only of letters, digits and underscores. This includes operands that might otherwise be interpreted as operators, constants, single number v-strings or function calls. If in doubt about this behavior, the left operand can be quoted explicitly.
Otherwise, the "=>" operator behaves exactly as the comma operator or list argument separator, according to context.