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

Re: tri-state flags

Thread Previous | Thread Next
Philip Newton
December 6, 2001 11:27
Re: tri-state flags
Message ID:
On Thu, 06 Dec 2001 13:46:41 +0100, (Bart Lateur)

> Also intersting to note is its behaviour WRT perl booleans. As you know,
> (or should know ;-)), is that these have a dual nature: a boolean false
> is 0 in numerical context, and "" in string context. Well, apparently ~
> thinks of it as a number.

I suppose it depends on the order in which the appropriate code behind
the ~ operator tests -- if it's "if(num) {...} elsif(string) {...}"
you'll obviously get diffferent results than from "if(string) {...}
elsif(num) {...}" for variables which have both the "is-num" and
"is-string" bit turned on.


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