Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: where do you put your subs

by seattlejohn (Deacon)
on Mar 08, 2002 at 06:50 UTC ( [id://150246]=note: print w/replies, xml ) Need Help??


in reply to where do you put your subs

Where do I put my subs? In modules, of course ;-)

Seriously, though, if I'm going to keep things in a single file I almost always put the subs toward the bottom. That way I get the main logic first, so when I open the file I can more easily get a 40,000-foot view of things. If I want to drill down, I can page down in my edit or search for "sub xxx". Not as easy to search for the beginning of the main code, IMO.

I used to do things the other way, probably because I first programmed in languages where you had to define subs before you could refer to them. Once I discovered Perl let me put subs at the end, I switched over and have never looked back... but admittedly, it's a personal preference / coding convention as much as anything.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://150246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-25 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found