When I need to distinguish between the three, I generally go with
if (!defined($bSomething)) { ... } elsif ($bSomething) { ... } else { ... }
and sometimes
my $x = defined($bSomething) ? $bSomething : $DEFAULT_VALUE; if ($x) { ... } else { ... }
The verbosity doesn't really bother me; it works with older versions of Perl; and it's easy to read.
Best, beth
In reply to Re: An idiom for selecting true, false, or undef.
by ELISHEVA
in thread An idiom for selecting true, false, or undef.
by kyle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |