in reply to An idiom for selecting true, false, or undef.
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
|
|---|