Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2014-09-21 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls