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...)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: xml simple not a hash reference
by Noverast (Initiate) on Dec 29, 2010 at 07:40 UTC | |
by morgon (Priest) on Dec 29, 2010 at 07:51 UTC | |
by Anonymous Monk on Dec 29, 2010 at 09:10 UTC | |
Re^4: xml simple not a hash reference
by Noverast (Initiate) on Dec 29, 2010 at 08:09 UTC | |
Re^4: xml simple not a hash reference
by Noverast (Initiate) on Dec 29, 2010 at 08:27 UTC | |
Re^4: xml simple not a hash reference
by Anonymous Monk on Dec 29, 2010 at 06:22 UTC |
In Section
Seekers of Perl Wisdom