in reply to Exiting script from subs
Personally I would always prefer to exit the program from within the main program rather than a sub-routine, of course you can't always achieve this due to exception conditions that may occur in the sub-routines (well you could if you were to wrap the whole of the program in a block eval - thus achieving a single point of exit.)
If nothing else it makes maintenance easier if there is only once logical point of exit from the program and that is easily visible within the main body of the code. This becomes more difficult with event driven programming (such as with a GUI or such-like) but it is still possible.
We are relatively lucky with languages such as Perl inasmuch as they will clean up all committed resources on program exit - but there have been systems where it was often a fatal mistake to exit the program without closing open filehandles or free allocated memory, but I would still consider it good practice to control the program flow in such a way that you are in a position to release resources where necessary.
(BTW you nearly got a whole spam e-mail instead of this - I pasted into the comment box rather than the spamcop text area and hit submit before I realised what I had done - more coffee needed.)
/J\
|
|---|