Using "foreach" or "grep" on a hash makes no sense. Tell us what you want to do, not how you want it to be done!
If want to enumerate the fruits in season (totally ignoring vegetables and fruits that aren't in season), you could use the following:
my $fruits_in_season = $xml->{Fruits}{Season}; for my $fruit_name (keys %$fruits_in_season) { my $fruit = $fruits_in_season->{fruit_name}; ... }
In reply to Re: Foreach hash of array
by ikegami
in thread Foreach hash of array
by rose
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |