[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] IP address regex golf



On Sat, Apr 29, 2000 at 01:30:18PM -0400, Jeff Pinyan wrote:
> On Apr 29, blm@halcyon.com said:
> 
> >The difference is that false and "" are indistinguishable here, but false
> >and 0 aren't.
> 
> Ah ha.  Bah. :)  Why doesn't Perl return 0 for false in logic cases like
> this?  That often boggles me.

Perl does return 0 for false.  But, Perl also returns "" for false.

As you know, a Perl scalar can have both a string value and a numeric
value.  False is a predefined scalar whose string value is "" and numeric
value is 0.  In a string context you get "", and in a numeric context you
get 0.

(The numeric value is an integer; scalars also have a floating point
value.)

Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe