[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
Re: [FWP] Closest hash value
Chaim wrote:
> >>>>> "FD" == Fergal Daly <fergal@esatclear.ie> writes:
>
> FD> You can get the "first" key with
> FD> ($best) = each %h;
>
> I know, but I'm not sure if that is optimized. It may cause all
> 1_000_000 keys to be copied to the stack and then the first item
> removed.
>
> Anyone know for sure?
Sure! No lists. each() is absolutely O(1).
John Porter
==== Want to unsubscribe from Fun With Perl? Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
==== unsubscribe