Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: A matter of style: how to perform a simple action based on a simple condition?

by GrandFather (Saint)
on Sep 26, 2010 at 04:02 UTC ( [id://862042]=note: print w/replies, xml ) Need Help??


in reply to A matter of style: how to perform a simple action based on a simple condition?

(almost) Never One - it requires too much brain work to figure out what's going on when scanning through code.

Never three - all that is seen is the condition; the action gets lost.

Most often Two. The action is obvious and generally the most important thing. If the condition is really important I'd:

if ($var) { sub (); }

to make the condition obvious and the action easy to find.

As a general rule stuff at the end of a long or complicated line will tend to be ignored. If it's important it be seen don't stick it on the end of a line.

True laziness is hard work
  • Comment on Re: A matter of style: how to perform a simple action based on a simple condition?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-19 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found