eval { # some perl code here . . . } if ($@) { print "eval failed: $@\n\n" ; } #### If there is a syntax error or runtime error, or a "die" state- ment is executed, an undefined value is returned by "eval", and $@ is set to the error message. If there was no error, $@ is guaranteed to be a null string.