Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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";

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 browsing the Monastery: (5)
As of 2016-06-26 23:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (333 votes). Check out past polls.