Keep It Simple, Stupid | |
PerlMonks |
Re: Data Structure Questionby kyle (Abbot) |
on Nov 25, 2009 at 21:52 UTC ( [id://809442]=note: print w/replies, xml ) | Need Help?? |
One way to handle this would be to put your data into a database and query it out. That can be useful especially if you have many many records or you have a data set that grows over time, and you don't want to build it repeatedly. I'd probably represent your data with an array of hashes.
What's nice about this is that each hash can expand to have more fields as necessary. When you want to summarize by any given field, you can do this:
What you'd get from that is a hash of arrays of hashes. Each key of the top level hash is a unique value of the field you specified, and that hash's values are references to an array of records that had that key-value combination.
In Section
Seekers of Perl Wisdom
|
|