Hello monks,

Let's say that I have a data file that can be represented by this notation:
a1 b1 c1 d1 e1 f1 a2 b2 c2 d2 e2 f2 a3 b3 c3 d3 e3 f3 p3 q3 r3 s3 t3 u3 a4 b4 c4 d4 e4 f4 a5 b5 c5 d5 e5 f5 p5 q5 r5 s5 t5 u5 a6 b6 c6 d6 e6 f6
Rules:
  1. All data is tab-delimited
  2. Some lines begin with a tab -- these are special cases
  3. Each line is obtained by reading a line from an open filehandle (ie. while(my $line = <FH>) { ...
  4. Any number of special case lines may occur after a parent line, but they always "belong" to this parent line (this is indicated by the subscripts being the same)
  5. Eventually, all lines will be split by tabs
  6. Data will be sorted on the d(n) field
Questions:
  1. What is the recommended data structure to be used?
  2. If data is to be sorted on the d(n) field, should data be split prior to insertion into the data structure or after?
  3. If the primary structure is a hashref, what should be used for a key?
I apologize in advance if this question is too abstract -- I will clarify as necessary.

Where do you want *them* to go today?

In reply to Selecting the right data structure by thezip

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.