Beefy Boxes and Bandwidth Generously Provided by pair Networks
DiBona Keep It Simple, Stupid  Re: why use a hash instead of an
array  by space_monk (Chaplain) on Jun 11, 2013 at 18:53 UTC
( #1038323=note: print w/ replies, xml ) Need Help??  in reply
to why use a hash instead of an array  i tried using variables
set to numbers to get values out of arrays and it seemed to
work. is that different from hashes? Yes :-). A longer answer is
that hashes use variables set to almost anything you like to set
or get values in something that is a bit like an array.  and i
would think the program would find the values faster if the keys
are ordered like the indices in arrays. The way values are
stored in hashes is in a sort of order.  Whilst hashing
implementations vary, what normally happens is that a hashing
function translates the key into an index element which refers
you to a bucket, which is a short list of possible matches. A
hash is often (but not always) faster than an array because you
do not have to search thro