I seem to keep running into the same problem, and as of yet I have not come up with a good way to solve it. Basically here is the deal. I get an some input data. Usually something to the effect of a bunch of lines that include category A and category B and some other junk. Usually there are six or eight values for category A and six or eight for category B (sometimes there is more sometime there is less last time I had to do this there were six and eight so the numbers are fresh). so far we have data that looks like this.
 CatA:CatB:something:else:andSuch
What I need to end up with is a grid with A cross referenced with B. so ideally something like this.
|______A_______________________________________ B | the value of some other field goes in here |

Sorting the keys would be nice, but that seems like it would be the easy part. Basically the main thing I am trying to do in all of my attempt at this is to print stuff out in nice easy to read grid format.
So far I have ran into this problem three times in the last three years , once in a class and twice at work. As of yet I have not come up with a solution I like yet. They all seem cludgy and more complicated than I like them to be.
My solutions so far have been.
1. a multi dimensional array
2. the same idea but with hashes because I was using strings I wanted to look them up by name rather than an array index.
3. I built a rather shoddy object which jeffa helped me to make much better, but the solution to the problem still sucked.(my solution not his)

The thing with all of these solutions is that they all seem to suck and use about 50 times more indirection / smoke and mirrors than need be. Anyone have any suggestions before this comes back to haunt me next year?
here is the code for the best attempt yet
Thanks
Josh

In reply to Changing the way data is formatted, a three year conundrum by krujos

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.