Venerable ones,
I searched and could not find any obvious information on this. I am using the mail command in a script on AIX (I can't use any of the the slick mail modules for Perl, as it would require updating thousands of production servers).
Simply put: I want to continue if the mail command is successful and exit out if it fails.
# subroutine for mailing/transferring the changes
sub mail_changes {
my $mailer = "|/bin/mail -s $hostn $recipients < $disk_changes";
open (MAIL, $mailer) || die "Cannot execute mail command; $!\n";
close(MAIL);
if ($? > 0) {
print "Do some error stuff if needed\n";
}
}
Any suggestions for a better way of checking for success other then the old
$? ?
thanks for your time.