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

Re: [MacPerl] find value in array



>On Tue, Oct 17, 2000 at 11:18:07PM -0700, Bruce Van Allen wrote:
>> At 1:48 PM 10/17/00, Ronald J Kimball wrote:
>> >
>> >I still prefer returning '0 but true' to avoid this problem, the way some
>> >of Perl's builtin functions do, rather than returning a reference.
>>
>> Cool. The expression $list['0 but true'] works like $list[0] !!
>
>Perl even goes so far as to special case the string '0 but true'; when it
>is converted to a number, Perl does not produce an "argument is not
>numeric" warning.

That's not a special case...try

print 0 + "77 seventy-seven" + "\n";

When a number is needed and Perl has a string, it converts as much of the
string as possible to a number and uses that.

Hence, "twenty" == "thirty" is true, since both are 0.

  --John

-- 
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org