Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 cooling their heels in the Monastery: (4)
As of 2025-07-17 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.