http://qs1969.pair.com?node_id=784454


in reply to Difference between array and a hash? (Newbie concerns)

Basically every "array" in PHP is an array and a hash, glued together. All of the values are stored in the hash as key/value pairs, but there's an array stored along with it that gives an ordering to the keys. The thing is, most of the time you either need one behavior (in-order processing) or the other (random lookup), and not both. PHP is giving you the overhead of both at all times; Perl is requiring you to say which one you really want. In the case where you really do need both methods, it's not very hard to set up the necessary parallel data structure in your own code, but Tie::IxHash is another option.