Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Best practices - if any?

by mirod (Canon)
on Feb 22, 2010 at 10:18 UTC ( #824601=note: print w/replies, xml ) Need Help??


in reply to Re^2: Best practices - if any?
in thread Best practices - if any?

I am not going to get into the details of this, but just a couple of quick stylistic comments:

  • instead of including anonymous subs in your hashes, why don't you name them? Instead of row => sub  { # complex code here that ASAIK creates a record }, write row => \&create_record, and then define create_record a little further. This way you're giving a name to that sub, and it becomes easier to see the data structure, without the big, often irrelevant, blob of code right in there.
  • $$flight{Reg}; can be written $flight->{Reg};, which is especially handy when writing $cols->[0]</<c> instead of <c>@{$cols}[0]
  • the commented-out code does not belong in there, if you have to remove code just do it, the source-control system will keep the old version.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://824601]
help
Chatterbox?
[Discipulus]: now i must come back to my house/hoven monks: dont do interesting discussion in my absence!
[erix]: or apparently, now it does :)
[GotToBTru]: heh
erix prods ambrus to (re-)start cbstream...
[GotToBTru]: I've got a program with an if ... or ... statement with 80 clauses
[stevieb]: 80 clauses? dispatch table?
[GotToBTru]: no, lookup
[stevieb]: no, I mean have you considered using a dispatch table. an 80 condition if/else is huge :)
[GotToBTru]: that is how this should have been done, no question

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-06-22 13:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (519 votes). Check out past polls.