Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by GrandFather (Sage)
on Sep 26, 2010 at 04:02 UTC ( #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
Node Status?
node history
Node Type: note [id://862042]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2017-07-27 04:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (402 votes). Check out past polls.