in reply to Re^11: the annoying keys "key" and "value"
in thread the annoying keys "key" and "value"

Let me try to nail at least one tentacle of this jellyfish to the wall: When you're trying to represent a hash, you aren't trying to represent ordering between the elements. That much we agree on. So why would someone try to represent a hash with an array of two element hashes each with the keys "key" and "value"?
  • Comment on Re^12: the annoying keys "key" and "value"

Replies are listed 'Best First'.
Re^13: the annoying keys "key" and "value"
by ikegami (Patriarch) on Dec 24, 2010 at 04:33 UTC

    So why would someone try to represent a hash with an array of two element hashes each with the keys "key" and "value"?

    "Represent a hash" makes no sense. I presume you mean "implement an associative array".

    Someone would do that if they wanted to preserve the order of the tuples. We've covered this multiple times already.

      So you want to have an ordered associative array by using: [{'key'=>somekey1,'value'=>somevalue1},...] because that is superior to having: $order=[somekey1,somekey2,...]; and {somekey1=>somevalue1,...} ?

      Is this because using the associative array for its primary function -- looking up values from keys -- is so much more convenient and efficient your way?

        It's not a question of efficiency, it's a question of actually working. $order=[somekey1,somekey2,...]; and {somekey1=>somevalue1,...} doesn't support more than one value with the same key.