For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2005 > sub main {}, main();









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sub main {}, main();
Michael

2005-10-23, 6:56 pm

I've been reviewing the scripts my old boss wrote (for grabbing device
configs, checking router stats etc.) They are always in the format
which includes "sub main { (code) }" and ends with "main ();". What is
the reason for using this format rather than the more basic format
taught in most basic perl lessons/books?

Thanks.

Paul Lalli

2005-10-24, 7:55 am

Michael wrote:
> I've been reviewing the scripts my old boss wrote (for grabbing device
> configs, checking router stats etc.) They are always in the format
> which includes "sub main { (code) }" and ends with "main ();". What is
> the reason for using this format rather than the more basic format
> taught in most basic perl lessons/books?


My guess? The author of that code comes from a C/C++ background, and
can't quite grok the concept of executing code not contained in a
subroutine.

Paul Lalli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com