http://www.perlmonks.org?node_id=879441


in reply to Re^2: xml simple not a hash reference
in thread xml simple not a hash reference

I don't know how to loop through the mealtypes

The same way you're looping through the roomtypes:

for my $mealtype ( @{$e->{mealtypes}->{mealtype}} ) { $rateid = $mealtype->{rateid}; }

but don't forget to apply ForceArray to mealtype, too; or check with ref if $e->{mealtypes}->{mealtype} is an array reference, and only loop in that case (otherwise, you'd get an error if there's only one mealtype entry, in which case XML::Simple (without ForceArray in effect) would not create an extra array...)