sub methodfunction { # take a spoonful die 'too hot' if $temp > $hottest_allowed; die 'too cold' if $temp < $coldest_allowed; } #### sub rollback { my $undesired = shift; print "That was $undesired. I shall try another bowl.\n"; } # and later ... eval {methodfunction()}; rollback($EVAL_ERROR) if $EVAL_ERROR;