### Re: The best "true zero" is...

by mce (Curate)
 on Jun 08, 2005 at 08:41 UTC ( #464589=note: print w/replies, xml ) Need Help??

in reply to The best "true zero" is...

Isn't 0E0 and "Larry's 0 but true" the same? :-)

---------------------------
Dr. Mark Ceulemans
Senior Consultant
BMC, Belgium

Replies are listed 'Best First'.
Re^2: The best "true zero" is...
by tbone1 (Monsignor) on Jun 09, 2005 at 13:04 UTC
Isn't 0E0 and "Larry's 0 but true" the same? :-)

Not at all. "0 but true" describes a state of data in Perl. "0E0" is part of the lyrics for the background singers in "Jungle Love" by Morris Day and the Time. Quite different.

--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee

Re^2: The best "true zero" is...
by ambrus (Abbot) on Jun 08, 2005 at 11:28 UTC

No, it's really the string "0 but true". Try this for example:

use File::Temp; \$th = File::Temp::tempfile(undef, "UNLINK", 1); \$zbt = + sysseek \$th, 0, 0; print \$zbt, "\n";

The "E0" suffix appears with the flip-flop operators, but "0E0" can never appear, only "1E0", "2E0" etc.

true, but also not true :-)

Many functions -like the execute function in DBI- return 0E0 when they want to return a result that is ment to be zero but is 'boolean' true in tests

So, indeed it is not general perl, but it is common to use 0E0 as "zero but true".

Cheers,

---------------------------
Dr. Mark Ceulemans
Senior Consultant
BMC, Belgium

That's right, but the core perl uses only "0 but true", so "0E0" is not Larry's.

Re^2: The best "true zero" is...
by ikegami (Pope) on Jul 28, 2010 at 16:35 UTC

No.

\$ perl -wle'print "0 but true" eq "0E0" ?1:0' 0

They are both silently equal to zero yet true, but so are the other poll options (except "0x0").

\$ perl -wle'print 0+"0 but true"' 0 \$ perl -wle'print 0+"0E0"' 0 \$ perl -wle'print "0 but true" ?"true":"false"' true \$ perl -wle'print "0E0" ?"true":"false"' true

Create A New User
Node Status?
node history
Node Type: note [id://464589]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-06-24 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How many monitors do you use while coding?

Results (556 votes). Check out past polls.