more useful options | |
PerlMonks |
Re: Using multi-level hashesby shemp (Deacon) |
on Oct 28, 2005 at 21:39 UTC ( [id://503782]=note: print w/replies, xml ) | Need Help?? |
As for your first question of how to reduce the amount of typing, it very much depends on what you want to do with your structure. If you're populating it, you probably have some simpler structures that contain the data being entered into the 3-level hash. Loop through them. Or if you're manually adding each elemnt, you're somewhat stuck.
For the second part, in relation to your readItem() function, and assigning to the structure, you have multiple problems. First off, you should pass you structure in to the function, instead of using it as a global, i.e.: If that doesn't make sense, you need to read more about variable scope. As for assigning into a referenced subpart, the important thing to consider is what just got deferenced when you created the sub part. Is it a hashref thats also pointed to by your big structure, or is it a scalar, or is it a newly created anonymous structure? the $part_two example may make more sense if you think of this:
I use the most powerful debugger available: print!
In Section
Seekers of Perl Wisdom
|
|