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

Hello, I get the following error when I execute the below script "Can't call method "mail" on an undefined value at ./recalert.plx line 24, <RECCHK> line 9." I did not write the original perl script, I just modified the email addresses to work in my environment, and the email addresses in the below script are sanitized. The script has worked for about three years without issue, I really have no perl experience, and not sure what the error means, or how to fix it/ Please help

#!/usr/bin/perl -w $from = ''; $to = ''; $servername = ''; # $user ='username'; # $pwd ='password'; open RECCHK, "/tmp/statusmon.eml"; @recchkvar = <RECCHK>; use Sys::Hostname; my $host = hostname(); my $host1 = uc($host); open STDERR, '>&STDOUT'; #redirect STDERR output to STDOUT use Net::SMTP; $smtp = Net::SMTP->new("$servername", Debug => 1); ### Enable below if authentication required and set parameters above # $smtp->datasend("AUTH LOGIN\n"); # $smtp->datasend("$user\n"); # $smtp->datasend("$pwd\n"); sleep(2); $smtp->mail("$from"); $smtp->to("$to"); $smtp->data; $smtp->datasend("Subject: 79XX/69XXC/WB3 InfiniStream $host1 has an is +sue, and requires investigation \n"); foreach $line (@recchkvar) { $smtp->datasend("$line\n"); } close RECCHK; $smtp->dataend; $smtp->quit