in reply to Help explaining data structure

%val is a hash of array of arrays.

%num is a hash of hashes.

I believe that was what you were asking for.

UPDATE: Changed the $ to % as pointed out by ikegami

Replies are listed 'Best First'.
Re^2: Help explaining data structure
by ikegami (Patriarch) on Oct 03, 2005 at 03:37 UTC

    True, but that should be %hash and %num.

    Another important bit of information is how each array/hash is used. They are typically used to store a list of elements or a set of fields (record/object). I'm guessing:
    %val is a hash (named list) of array (record/object) of arrays (ordered list).
    %num is a hash (named list) of hashes (record/object).

Re^2: Help explaining data structure
by mhearse (Chaplain) on Oct 03, 2005 at 02:55 UTC
    Yes, I see now. Probably should have stared at it a while longer before posting. I wonder if there is a friendlier way to write it? I don't think the arrow notation can be applied.
      I don't think the arrow notation can be applied.

      Sure it can... These are all equivalent:

      1. $val{$file}[3][$num{$alias}{save}] 2. $val{$file}[3][$num{$alias}->{save}] 3. $val{$file}[3]->[$num{$alias}{save}] 4. $val{$file}[3]->[$num{$alias}->{save}] 5. $val{$file}->[3][$num{$alias}{save}] 6. $val{$file}->[3][$num{$alias}->{save}] 7. $val{$file}->[3]->[$num{$alias}{save}] 8. $val{$file}->[3]->[$num{$alias}->{save}]
      Of those, I would prefer number 6 with some whitespace added for readability.
      $val{$file}->[3][ $num{$alias}->{save} ]
      -sauoq
      "My two cents aren't worth a dime.";
      
      "Yes, I see now."

      You did see from the beginning ;-) array of array refs is the same as two dimentional array. Put in this way, two dimentional array is the logical view across languages, and array of array refs is the Perl way of realize the concept.

      Due to the fact that the second level arrays are not required to have the same length in Perl, they have to be refs, so that the information about their lengthes is not lost because of the flattening.