If you look a bit more closely at your data, you'll notice that data/bb/roomtypes/roomtype is an arrayref holding a hashref. So I'd suspect that your code is trying to do something like:
$hrXml->{data}{bb}{roomtypes}{roomtype}{$aKey};
instead of:
$hrXml->{data}{bb}{roomtypes}{roomtype}[$anIndex]{$aKey};
Note: I've seen a couple other array references in your data too, but I only mentioned the first one. So your error may be coming from one of the others. Also, if you're going to post a chunk of data like that, you should indent your data using less whitespace to make it a bit more readable.
I've heard about XML::Simple having an option (ForceArray) to force certain keys to always use an array reference. I believe (having never used it) that it'll use an array reference if the key has multiple sub-values and a hash reference if the key has only one. That can make your code a little tricky. But if you use ForceArray for the keys that may change on you, then your code can be simplified. (Anyway, that's what I gather from several posts. I'm sure someone will correct me if I misunderstood.)
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re: xml simple not a hash reference
by roboticus
in thread xml simple not a hash reference
by Noverast
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |