On Mon, Aug 21, 2000 at 09:00:26PM -0400, Casey R. Tweten wrote:
> Today around 3:34pm, Tom Christiansen hammered out this masterpiece:
> : No.  keys() expects something that starts with a %, not
> : something that starts with a &.
> 
> Wow.  Now that, that, is lame.  You're saying that keys() expects it's first
> argument to begin with a %?  Why should it care what it's argumen begins with?

It cares because it is only defined to operate on hashes.  A list is
not a hash.

> All functions recieve their arguments in a LIST via @_.  Since &func, in the
> above example, returns a LIST, that LIST should just be passed on.

Exactly.  This is what happens.  keys() doesn't operate on lists.

> keys( @array );

So this would "convert" @array to a hash and take the keys of that?
Or does it (as some have proposed) return the keyable indices of
sparse array?

> Otherwise, work something like this:
> 
> sub keys {
>   my %hash = @_;
>   return keys %hash;
> }

Ah, convert is argument to a hash then grab the keys of that hash.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to