in reply to An idiom for selecting true, false, or undef.

I seldomly need an idiom to distinguish between all three - in most cases, I'm either interested in "true or false" or "defined or not defined". In the rare cases, the idiom I use depends whether I consider all cases equal or not.

fork is an example where not all cases are equal. undef signals an error condition, while true/false but defined happen equally often. So, I typically write:

my $pid = fork // die "fork: $!"; unless ($pid) { ... child stuff ... exit; } ... parent stuff ... wait;
Note that the above code doesn't have an else clause. That's intentional.

In the rare case all three cases are equally important, I might write:

given (EXPR) { when (!defined) {...} when (!$_) {...} default {...} }
or an if/elsif/else construct. But that's so rare, I can't even remember what I did last time. In the case of wantarray, wantarray being not defined is the exceptional case - if I'm interested in it, I most likely use it for flow control, bypassing expensive calculations.