|
|
| Problems? Is your data what you think it is? | |
| PerlMonks |
Array in a Hashby mt2k (Hermit) |
| on Dec 13, 2001 at 21:31 UTC ( [id://131801]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.mt2k has asked for the wisdom of the Perl Monks concerning the following question:
I have this really annoying problem that I can't seem to figure out... I need to create a hash that contains two sets of arrays embedded. Editting the array in the hash would look like this:
Or maybe like this, I'm not sure:
Now, under the key2 key, I don't know how many values are in that array. (The first set of array numbers, namely 0, 1, and 2). The second set of array numbers (The constant 0 and 1) are always there and only have the indexes 0 and 1. Could someone please give me an idea what this hash structure would look like, and how I would go about getting the last index number of the first set of array numbers. (Something like $#{$db{'key1'}{'key2'}} maybe?) And also, how would I go about deleting the array? I don't want to do delete $db{'key1'}{'key2'}, but something more along the lines of delete $db{'key1'}{'key2'}[3]. Thanks ahead of time!
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||