good chemistry is complicated,
and a little bit messy -LW
Assign 2D-Arrays to a hash using a keyby mmartin (Monk)
|on Feb 20, 2012 at 21:50 UTC||Need Help??|
mmartin has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to assign the values from a couple of 2-D Arrays into a hash based on a "key" within the array.
I haven't messed with hashes in a while so I'm a little rusty. I'm having trouble figuring out how to assign the values, I looked for an example online but alas Google has failed me lol...
What I have is 5 separate 2-Dimensional Arrays. All arrays have the same setup.
For Example: @myArray[key][value]
I'm having trouble figuring out if I need a loop or what not, because not all the arrays are the same length.
Occasionally a couple of the arrays might have more than one value for a particular key...
i.e. It might have 2 values like this below for the key "111".
If anyone has any hints that could point me in the right direction that would be great...
I've read the PerlDocs on hashes but I am still a little confused.
Thanks in Advance,