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

Hmm, that doesn't clarify it for me
  • Comment on Re^5: the annoying keys "key" and "value"

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

    Say you want an associative array.

    With a hash, a lookup would look like

    my $val = $hash{$key};

    With the OP's structure, a lookup would look like

    my ($val) = map $_->{value}, grep $_->{key} eq $key, @$data;

    That makes it a "pathological" structure to use as an associative array. However, it's an appropriate structure to store ordered key-value pairs.