|Perl Monk, Perl Meditation|
How to add to hash of a hash of an array. Confused.com!by Doozer (Beadle)
|on Jun 13, 2013 at 10:02 UTC||Need Help??|
Doozer has asked for the
wisdom of the Perl Monks concerning the following question:
I have a pretty complicated (for me anyway) hash setup as shown in the example snippet below:
What I want to do is check whether C1 or C2 exists. If it exists, I want to add another item to its array. If C1 or C2 does not exist, I want to create it as an array reference and add an item to its array.
At the moment my code looks something like this:
The code doesn't work as I get various "Can't use string ("") as a HASH ref while "strict refs" in use" errors. I am getting very confused with all of the searching I have done to find the answer so would really appreciate it if someone could point me in the right direction.
The aim is that B2 would be a 'Test Results' key. The 'C' keys would refer to dates and then the arrays within them would be the data of the results (single line sentences) for that dates tests