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

Re: [MacPerl] pop (keys %hash) ?



At 15.33 -0400 1999.06.18, Shawn O'Donnell wrote:
>At 1:46 PM -0400 6/18/99, Chris Nandor wrote:
>>You could do something like:
>>
>>  $element = pop @{[keys %hash]};
>>
>>This puts keys %hash into an anonymous array reference [], and then @{}
>>dereferences it to be used as an array.
>>
>
>Interesting, but I'm confused by the documentation.  perlfunc says
>
>     keys HASH
>
>         Returns a normal array consisting of all the keys of the
>         named hash.

Your docs are wrong.  Mine say:

    Returns a list consisting of all the keys of the named hash.

I have the perl5.005_ something docs here.  The docs that came with 5.004
(and hence, MacPerl) are wrong in this regard.


>Leaving aside the problem of lastness in a hash, why can't you pop
>off the array returned by keys HASH?

Because it is a list, not an array.  :)

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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