> -----Original Message----- > From: Stephan Tinnemeyer [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 20, 2001 9:22 AM > To: [EMAIL PROTECTED] > Subject: structure of scripts (newbie Q) > > > I hope I did not overread this in the FAQ: > > In some tutorials I found the recommendation to put the code for > subroutines at the end of a script (i. e. after calling them) > but it was > never explained why I should do so. I only see disadvantages: > > 1. In my simple mind this would only make the interpreter jump through > the script which should not enhance the performance. This is not an issue. Perl scans your entire script once and compiles it before executing it. > > 2. Human beings have to jump through the script as well when they > attempt to understand how the script is working. This is a problem no matter how you do it. Unlike C, there is no main() function in Perl. All the code before, after, or between sub's becomes your main program. You should clump it all together at the top or bottom of the file. The only "disadvantage" of putting it at the beginning I see is that you can't all subs without parens unless the sub has been declared or prototyped. Personally, I have never had this be a problem. I just put the main program at the top and define all my subs following, in whatever order is appropriate (alphabetical, order called, etc.). I always call my subs with parens. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]