Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: undef == 0?

by snopal (Pilgrim)
on Oct 24, 2007 at 18:29 UTC ( #646959=note: print w/replies, xml ) Need Help??


in reply to Re: undef == 0?
in thread undef == 0?

Tristate... you said the magic word!

my $test = return_from_function(); if (not defined $test) { # do this if evaluates to undefined } elsif (!$test) { # do this if evaluates to zero equivalent } elsif ($test) { # do this if evaluates to non-zero equivalent }

If you really wanted, you could throw in a $test eq '' in there too, but I've found that to be gratuitous code abuse.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2020-10-26 16:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (252 votes). Check out past polls.

    Notices?