eval {die;}; if (my $e = $@) { # <--- secure... warn "Got the exception '$e'!"; exit(0); } #### eval {exit;}; if (my $e = $@) { # <--- secure... warn "Got the exception '$e'!"; exit(0); }