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

Re: [MacPerl] Some suggestions?



On Wed, May 19, 1999 at 05:57:25PM -0400, Allan Greenier wrote:
> I guess I can't quite figure how a hash is the answer...because the
> search is by key? But doesn't Perl have to go through all the keys just
> like it would a list?

No.  The whole point of a hash is that a string can be looked up without
looping over the list of keys.

A hash function is used to convert the string to a number, and this number
is used like a regular array index to find the appropriate value.

There's a lot more going on than that, of course, but I don't know if it
would be that interesting to explain in depth.


Ronald

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