Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: OEO, a zero that evaluates to true?

by princepawn (Parson)
on Jan 08, 2002 at 13:51 UTC ( #137082=note: print w/ replies, xml ) Need Help??

in reply to OEO, a zero that evaluates to true?

I'm surprised that "0" is false...

I added in checks for floating point zero as well...

#!perl -w use strict; my $oero = "0E0"; my $zero = "0"; my $foat = 0.0; print "oero ($oero) true\n" if($oero); print "oero ($oero) defined\n" if(defined($oero)); print "zero ($zero) true\n" if($zero); print "zero ($zero) defined\n" if(defined($zero)); print "foat ($zero) true\n" if($foat); print "foat ($zero) defined\n" if(defined($foat)); print "zero eq oero\n" if ($oero eq $zero); print "zero == oero\n" if ($oero == $zero); print "oero+1: ", $oero+1, "\n"; print "oero+zero: ", $oero+$zero, "\n"; print "oero+oero: ", $oero-$oero, "\n";

Comment on Re: OEO, a zero that evaluates to true?
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://137082]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2015-10-09 16:51 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (247 votes), past polls