SPUG: 0E0 Re: "Boolean" return values

mark.mertel at yahoo.com mark.mertel at yahoo.com
Tue Oct 14 09:32:47 PDT 2008

on a not too unrelated tangent - Config::General allows for 'true', 'ok', '1', 'yes' as true values, and 'false', 'not ok', 0, 'no' as false values

Mark Mertel
mark.mertel at yahoo.com

----- Original Message ----
From: David Dyck <david.dyck at fluke.com>
To: "DeRykus, Charles E" <charles.e.derykus at boeing.com>
Cc: spug-list at pm.org
Sent: Tuesday, October 14, 2008 9:27:12 AM
Subject: Re: SPUG: 0E0 Re:  "Boolean" return values

On Tue, 14 Oct 2008 at 08:56 -0700, charles.e.derykus at ... wrote:

>> Indeed, '0E0' (scientific exponent notation floating point) evaluates
> to zero... but is not false.
> Perl even provides its own  "lipstick for a pig" in the spirit of '0E0':
> $ perl -wle 'print "true" if "0 but true"'
> true
> $ perl -wle 'print "0 but true" + 1'
> 1

Another place where perl (ever since perl1) uses the 
"E0" special flag is in the ".." range operator
(The "0 but true" seems to have started around perl3)

see perldoc perlop:

      Range Operators

      Binary ".." is the range operator, ....

     ...  The final sequence number in a range has the string "E0"
     appended to it, which doesn't affect its numeric value, but gives
     you something to search for if you want to exclude the endpoint.  ...

Seattle Perl Users Group Mailing List
     POST TO: spug-list at pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
    MEETINGS: 3rd Tuesdays
    WEB PAGE: http://seattleperl.org/


More information about the spug-list mailing list