I would have expected something more like# This looks wrong, but it's what you gave us my $batches = $data->{Jobs}{Job}{Blocks}{Block}{Batches}{Batch}; for my $batch (@$batches) { # This looks also wrong my $item = $batch->{Items}{Item}; print $item->{CorporateName} . "\n"; print $item->{Amount} . "\n"; }
my $jobs =$data->{Jobs}{Job}; for my $job (@$jobs) { my $blocks = $job->{Blocks}{Block}; for my $block (@$blocks) { my $batches = $job->{Batches}{Batch}; for my $batch (@$batches) { my $items = $batch->{Items}{Item}; for my $item (@$items) { print $item->{CorporateName} . "\n"; print $item->{Amount} . "\n"; } } } }
By the way , the following would simplify your tree:
GroupTags => { Jobs => 'Job', Blocks => 'Block', Batches => 'Batch', },
In reply to Re^3: XML::Simple Multi Level Array
by ikegami
in thread XML::Simple Multi Level Array
by drodinthe559
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |