http://qs321.pair.com?node_id=356446


in reply to Entering and exiting subs in style

I'd say you want to do some (which could easily become "LOTS of") reading up on exception handling which basically involves calling 'die' in one form or another and then catching it further up your code tree. This is a fairly large subject matter so I'll just refer you to some existing threads.. 8) ..exception handling.

Greatly simplified, untested code..

#--------- 1 ------------ eval { foo() }; if ($@){ # Houston, we have a problem my $error = $@; } else { # everythings ok. } sub foo { &bar; } sub bar { if ($negative) { die('bar is negative'); } return(); }

cheers,

J