your current structure is problematic, because HoHs are unsorted and you can't distinguish what the row/column headers are
(untested){ columns => { Male => 0, Female => 1 }, rows => { "0-9" => 0, "10-19" => 1, "20-29" => 2 }, data => [ [220, 175, 260], [180, 142, 265] ] }
You need to look-up indices to get the data now.
This could be encapsulated in a tied hash or an object class.¹
"Age Group" makes it a bit more complicated, not sure what it is, how would you call it?
Maybe a "CATEGORY" field of the rows?
I hope you get the point and this helps. :)
PS: pretty sure someone will come up with a CPAN² module now... :)
¹) for instance you could bless the hash above into a class My::Table . Then $obj->rows returns a list of names, and $obj->entry("Male","0-9") returns the entry, and so on.
²) like Data::Table
In reply to Re: Building data structure from multi-row/column table
by LanX
in thread Building data structure from multi-row/column table
by rwx---
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |