[Phoenix-pm] poll: top or bottom?

Corey Saltiel corey_s at streamreel.com
Fri Apr 7 13:54:34 PDT 2006


Where do you guys place your subroutines in scripts?

And what do you usually prefer to call the subroutine that kicks things off, 
i.e. 'main()', 'begin()'?

I've always put my subroutines at the top, right after the basic setup logic
( declaring pragmas and modules, and whatever global vars, etc ), then I 
throw  the call  to the entering/main subroutine at the very bottom of the
script, underneath the subroutines -- but I tend to be switch between 
calling the entering subroutine either: main() or begin() - out of sheer 
indecision. 

Like so:

#!/usr/bin/perl
use warnings;
use strict;

use ACME;
use Blah;

my ( $globals, $go, $here ); # minimal or non-existant

$globals = '';

$go = '';

$here = ''


sub foo { }

sub bar { }

sub snafu {}

sub begin {}


begin();


Anyhow, just curious!  Obviously mostly a matter of subjective opinion, but
interesting none-the-less.


Beers,

Corey


More information about the Phoenix-pm mailing list