SPUG: "Boolean" return values

Joshua ben Jore twists at gmail.com
Sat Oct 18 07:50:26 PDT 2008


On Wed, Oct 15, 2008 at 12:29 PM, Michael R. Wolf <MichaelRWolf at att.net> wrote:
> Ronald J Kimball wrote:
>>
>> On Tue, Oct 14, 2008 at 08:08:37AM -0700, Michael R. Wolf wrote:
>>>
>>> In practice, most strings are true.  I know of only 3 false strings:
>>>  1. '', the empty string
>>>  2. '0', the string containing only a single zero
>>>  3. "\000", the ASCII NUL character (AKA chr(0)).
>>>
>>
>> There are only two false strings.  "\000" is true.
>
> I *knew* that there were only two false strings, but yesterday, on a whim, I
> tried #3 and (to my surprise) found it to be *false*. Unfortunately, I can't
> recreate that experiment today, so I guess I'm back to my original beliefs,
> based on the documentation you provided.
>
> Anyone know how I may have gotten "\000" to be hint that it's false?

Perhaps you numified your string. Since the string was non-numeric,
you got a zero which is false. This throws a warning when warnings are
enabled.

$false = 0 + chr 0

Josh


More information about the spug-list mailing list