in reply to Have script send email if it dies

You can use eval in the same way as try/catch in Java.
eval { # do something that might go wrong $a = 1; $b = 0; print $a/$b; }; if ($@} { print "Something went wrong: $@\n"; }
Don't forget the ; after the } at the end of eval statement.