"Michael R. Wolf" wrote:
> 
> [EMAIL PROTECTED] (John W. Krahn) writes:
> >
> > Are you sure there are only three?   :-)
> >
> > $ perl -le'
> > print qq(undef is FALSE) unless undef;
> > print qq("" is FALSE)    unless "";
> > print qq("0" is FALSE)   unless "0";
> > print qq(0 is FALSE)     unless 0;
> > print qq(0e0 is FALSE)   unless 0e0;
> > '
> > undef is FALSE
> > "" is FALSE
> > "0" is FALSE
> > 0 is FALSE
> > 0e0 is FALSE
> 
> You caught me; very nice counterproof.  You were obvoiusly
> right about the "0" (see "Camel citation below), but I'd
> suggest that 0 and 0e0 are the same - they're both scalar
> numeric zero.  I could be convinced otherwise if there's a
> reason to make the distinction between these:
> 
>   scalar numeric float zero (0e0)
>   scalar numeric int zero   (0)
> 
> I originally suggested 3 false values, you counterproposed
> 5, and now I'm counter-counterproposing 4.
> 
> I've modified the test (with answers) as below.
> 
> test> Any value that is not false is true.  What values indicate false?
> test>
> test> string  -- _""____  _"0"___
> test>
> test> numeric -- _0_____
> test>
> test> other   -- _undef_
> test>
> 
> When scoring it, I'll accept 0e0 instead of or in addition
> to 0, but I'm not likely to get it since I won't mention the
> distinction in class.  There isn't really an user-level
> distinction between int and float like there is a
> distinction between string/numeric and scalar/array.

The reason I threw in the 0e0 is that although 0 stringified is also
false this is not true for "0e0" which is true.

$ perl -le'
print q("0e0" is ), "0e0" ? "TRUE" : "FALSE";
print q( 0e0  is ),  0e0  ? "TRUE" : "FALSE";
'
"0e0" is TRUE
 0e0  is FALSE



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to