in reply to Re: What makes an array sorted and a hash unsorted?
in thread What makes an array sorted and a hash unsorted?

Having probably instigated this with my use of the term today :), I was browsing over wikipedia entries while eating lunch and trying to come up with my take. I think that you're getting at the distinction here: Perl has associative arrays (an abstract datatype) which are implemented on top of hash tables (a more concrete datatype; which of course explains the colloquial usage of calling them "hashes"). However neither of these two guarantees nor provides any intrinsic ordering of keys. Were the associative arrays implemented on top of something else instead (say some sort of binary search tree, or an assoc list with new items added in sorted order rather than just prepended) the underlying implementation would then provide an intrinsic ordering of keys and then Perl's associative arrays could be said to be ordered (and probably wouldn't be called hashes . . . :).

So yeah, "unordered" is probably a better description than "unsorted".

The cake is a lie.
The cake is a lie.
The cake is a lie.

  • Comment on Re^2: What makes an array sorted and a hash unsorted?