in reply to Selecting the right data structure

The shape of the data in the file is of almost no interest at all in determining the data structure you need. That is dictated by how you want to use the data. When you know how you want to use the data (and therefore have some idea of the data structure required) then you can figure out how to transform the file representation of the data into the internal data structure.


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Selecting the right data structure
by thezip (Vicar) on Mar 02, 2007 at 23:23 UTC
    First, I will traverse the sorted array of parent lines. This could be derived from the keys of a hash, or from an array.

    When a parent has children, I'll need to process/aggregate each of those elements, and associate the result with the parent.

    I'm leaning towards this structure:
    $a->[n]->[0] = arrayref to split parent lines $a->[n]->[1] = arrayref to arrayref of split children lines
    Where do you want *them* to go today?