in reply to Re^2: Exiting script from subs
in thread Exiting script from subs
Now, die() and exit() do different things. The biggest difference is
vs.eval { print "Inside\n"; die; }; print "Outside\n"; ---- Inside Outside
exit() exits, end of story. die() allows for some manner of error trapping. This is the main reason why die() is preferred within subroutines. You may want to reuse that subroutine somewhere else that wants to be able to trap the abnormal termination. Also, die() triggers $SIG{DIE}, which can also be useful to trap.eval { print "Inside\n"; exit; }; print "Outside\n"; ---- Inside
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Exiting script from subs
by gam3 (Curate) on Apr 16, 2005 at 03:10 UTC | |
by dragonchild (Archbishop) on Apr 18, 2005 at 12:35 UTC |