[Phoenix-pm] poll: top or bottom?

Metz, Bobby W, WCS bwmetz at att.com
Fri Apr 7 14:02:19 PDT 2006


It's Perl so anything goes and we won't shoot you for it, well some of
us anyway.

That said, "bottom" to your 1st ? and "no" to your 2nd.  I find those
folks who came from a C background or studied programming more in
college tend to start with functions @ the top.  I was one of those, but
I always eschewed having to scroll through pages of code just to get to
the begining, search features or not.  But that's just me.

B

-----Original Message-----
From: phoenix-pm-bounces+bwmetz=att.com at pm.org
[mailto:phoenix-pm-bounces+bwmetz=att.com at pm.org]On Behalf Of Corey
Saltiel
Sent: Friday, April 07, 2006 1:55 PM
To: phoenix-pm at pm.org
Subject: [Phoenix-pm] poll: top or bottom?



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
_______________________________________________
Phoenix-pm mailing list
Phoenix-pm at pm.org
http://mail.pm.org/mailman/listinfo/phoenix-pm


More information about the Phoenix-pm mailing list