# starting point sub start { eval { call1(); call2(); }; return 0 if $@; return 1; } sub call1 { # code here die "Error in call1" if $something_nasty; call3(); # more code } sub call2 { # code here die "Error in call2" if $something_nasty; # more code here.. } sub call3 { # code here die "Error in call3" if $something_nasty; # more code here.. }