Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 ambrus (Abbot) on Jun 08, 2005 at 07: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 tbone1 (Monsignor) on Jun 09, 2005 at 09: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 ikegami (Patriarch) on Jul 28, 2010 at 12: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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://464589]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.