I'm going to go out on a limb and guess that you're reading a bunch of bioinformatics data. I'm also going to guess that this data is (or can be easily) sorted at your source. I'm also guessing that you want to just get this information.

Given all of that, you probably should only read the info from the file that you need, then do your calculations. After that, discard the data you've gotten and go to the next group. (This will reduce your memory needs by at least 90%, given a typical bioinformatics dataset.)

Now, if you do that, you don't need to split your initial key into four keys. In fact, since all the data you're working with has to do with those, you don't need to use it as a key at all. So, all you have is your topic, your index, and your value - a standard 2-D data structure. Try working with that and see how far you get.

If your data isn't sorted, I would sort it first and save that to some file (or set of files). Then, use that as your data source for summations and the like.

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


In reply to Re: sorting an array of hashes by the value of the keys by dragonchild
in thread sorting an array of hashes by the value of the keys by Anonymous Monk

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.