eval { system("perl 2.pl"); }; if($@) { print "the error that was thrown in 2.pl"; } ... #### system("blah") or die "Can't blah $!\n"; #### my $ret_val = system("perl 2.pl"); if ( $ret_val == 0 ) { print "Success"; } else { printf "Error. Err Number: %d", $ret_val<<8; } #### exit 0 if $success; exit $err_num if $err_num; # numerical error value exit -1; # WTF??? #### open F, $file or do { warn "Can't open $file for read $!\n"; exit 1; # Error code for can't open file } do_stuff(*F); close F; exit 0;