# 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";
}
I would have expected something more like
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',
},
|