Re: Get values from hash "in order"

still just me wrote:
[about hashes]
Is there some advantage to Perl in them storing in random order?
Perhaps some internal storage efficiency?

Actually the order in which e.g. each() or keys() cycles through the items
of a hash is not random at all but it is well defined and guaranteed to be
the same for every access to that hash. It is just that this sequence
doesn't make any sense to the programmer because this sequence is -as you
suspected- based on the internal implementation and not on some human
expectation about useful order.

However, on an abstract level, hashes are a generalization of arrays. Arrays
are mappings from natural numbers (assuming you didn't mess with $[) into
scalars while hashes are mappings from arbitrary strings into scalars.
Natural numbers have an inherent sequence, there is a natural next and
previous. Therefore you can specify a concrete point in the array and from
there access the next and the previous element.
There is no such obvious sequence for strings. Alphabetical sorting is not
compact, i.e. between any two given strings there is always another string.
And incremental strings as produced by the ++ operator are not what people
would expect from a sorted hash.

And because there is no such obvious order on the domain elements of hashes
as is are the natural numbers for arrays it doesn't make sense to speak of a
sequence of the elements of hashes. Sequence of order is foreign to hashes.