I am coding a site where with each item you could have just a value, an array of items or a hash. I'm putting all this into a large hash and need to pull it all out again and know which piece is which. OK, this is hard to explain so here's how I'm generally contructing it (these are actually form fields on multiple forms):
myHash[item1] => 1
myHash[item1][sub][] => 'some words'
myHash[item1][sub][] => 3
myHash[item1][sub2][sub3] => 'something'
myHash[item1][sub2][sub4] => 'something'
myHash[item1][sub2][sub5] => 6
myHash[item2] => 'foo'
myHash[item3][] => 8
myHash[item3][] => 'more foo'
myHash[item3][] => 'more more foo'
myHash[item3][sub][] => 'bar'
etc.
I want to itterate through "myHash" and list all the items, but how do I figure out if the value of myHash[0] or myHash[10] is an array, a hash or just a string if I don't know before hand? Maybe I'm trying to hard and the answer is obvious, but I'm just not getting it. Could somebody help, please.
Thanks in advance!
Stephanie