Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Short form (ternary) if else

by trwww (Priest)
on Feb 09, 2012 at 17:38 UTC ( #952795=note: print w/ replies, xml ) Need Help??


in reply to Re: Short form (ternary) if else
in thread Short form (ternary) if else

Whenever I see this I usually see this right afterwards:

if ( $vxdg != '' ) {

Where they should probably be using:

if ( $vxdg ) {

Which would make the || "" in the assignment unnecessary.

Yes, I understand sometimes zero and the empty string are distinct values from undef in many business rules, but I don't think that applies as aften as many coders believe.


Comment on Re^2: Short form (ternary) if else
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (19)
As of 2015-07-01 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls