eval { some code that might die() }; if ($@) { handle the exception you find in $@ }