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

Re: tri-state flags

Thread Previous | Thread Next
From:
abigail
Date:
December 5, 2001 02:35
Subject:
Re: tri-state flags
Message ID:
20011205103400.703.qmail@foad.org
On Wed, Dec 05, 2001 at 05:11:43AM -0500, Michel Lambert wrote:
> > defined $flag && !$flag
> > So, who does better?
> 
> 
> defined ($var = $flag) && !$var
> 
> $flag is only evaluated once. :)


But Bart said he wanted to test for 0. The test above, and several of
the other proposals don't distinguish between 0 and the empty string.


do {no warnings; not local $_ = $flag and length};



Abigail

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About