develooper Front page | perl.fwp | Postings from December 2001

Re: tri-state flags

Thread Previous | Thread Next
December 5, 2001 21:28
Re: tri-state flags
Message ID:
In article <>,
Bart Lateur <> wrote:
>I often use tri-state flags, with possible value true (1), false (0), or
>undetermined (undef).
>The question is: how do you test for one of the flags, in particular for
>0, without warnings?

Here's one way :)

use Data::Dumper;
$Data::Dumper::Terse = 1;
if (Dumper($flag) eq '0') ...

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About