in reply to Array vs. Hash (newbie perlguts)
if you know all the indicies before hand i wouldnt go for a hash of arrays as why complicate things? $array[0] is easier to read than $hash{1}[0]
i'm guessing by saying you've got 1..m dimensions in your data (represented by the hash element), why not split it out into 3 or 4 arrays, and only populate the array if there is a value to populate it. this way you can make your data denser while conserving space not really required by a hash. of course this makes it more difficult to parse the data around as you have to parse four structures (or references to), rather than a single reference. Without more specifics of the project and data model, its a little too difficult to make any specific suggestions.
As always it looks like a trade off.. this time around its resources againts complexity.
|
|---|