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.
In reply to Re^2: undef == 0?
by snopal
in thread undef == 0?
by stu42j
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |