"be consistent" | |
PerlMonks |
Data Structure Questionby bohrme (Scribe) |
on Nov 25, 2009 at 20:34 UTC ( [id://809426]=perlquestion: print w/replies, xml ) | Need Help?? |
bohrme has asked for the wisdom of the Perl Monks concerning the following question: I think my brain disappeared temporarily. I'm trying to figure out the best way to to organize my data so that I can produce output in a more flexible way. For example, let's say that I have 3 pieces of data: Employee Number, Form Number, Date and I want to be able to produce a summary based on either the Employee Number or Form Number. E.g., For employee 1, list all the form numbers and when they were signed and, likewise, list the employees that have signed a particular form with date signed. I know that I could stick everything in an sequential array and just offset by three until the third offset counter equals the size of the array but looking at the code is making me ill. Of course, this assumes that every set of data has exactly 3 elements, which is the case here (seems like a poor coding practice to me though). Unfortunately, I've never really dealt with complex data structures so I'm a little at lost as to how to structure this data. A hash of arrays, hash of hashes, etc. If that doesn't make sense here's some test data:
I'm trying to make the output look something like this:
Or
Hopefully, that makes more sense than my word-based explanation. Thanks
Back to
Seekers of Perl Wisdom
|
|