# 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"; } }