$db{'key1'}{'key2'}[0][0] = "one_value"; $db{'key1'}{'key2'}[0][1] = "two_value"; $db{'key1'}{'key2'}[1][0] = "three_value"; $db{'key1'}{'key2'}[1][1] = "four_value"; $db{'key1'}{'key2'}[2][0] = "three_value"; $db{'key1'}{'key2'}[2][1] = "four_value";
Or maybe like this, I'm not sure:
@{$db{'key1'}{'key2'}[0][0]} = "one_value"; @{$db{'key1'}{'key2'}[0][1]} = "two_value"; @{$db{'key1'}{'key2'}[1][0]} = "three_value"; @{$db{'key1'}{'key2'}[1][1]} = "four_value"; @{$db{'key1'}{'key2'}[2][0]} = "three_value"; @{$db{'key1'}{'key2'}[2][1]} = "four_value";
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!
In reply to Array in a Hash by mt2k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |