use warnings FATAL => 'all'; use strict; my %hash = ( article => [ { InternalSKU => '179', Name => 'wiggle', external_source => [ { mfg => 'AMD', SKU => 'CDS00013', count => 100, }, { mfg => 'Intel', SKU => 'FOO00099', count => 42, }, ], }, { InternalSKU => '180', Name => 'woggle', external_source => [ { mfg => 'AMD', SKU => 'CDS00014', count => 102, }, { mfg => 'Intel', SKU => 'BAR00042', count => 99, }, ], }, ], ); my $ref_to_article_anon_array = $hash{article}; for my $hashref (@$ref_to_article_anon_array) { my $i_sku = $hashref->{InternalSKU}; my $name = $hashref->{Name}; print "Name $name; Internal SKU: $i_sku; Source(s): \n"; my $grand_total = 0; for my $hr_external (@{ $hashref->{external_source} }) { # my $mfg = $hr_external->{mfg}; # my $sku = $hr_external->{SKU}; # my $count = $hr_external->{count}; my ($mfg, $sku, $count) = # either way works @$hr_external{ qw(mfg SKU count) }; $grand_total += $count; print " mfg $mfg; mfg's SKU: $sku; count: $count \n"; } print "total ${name}'s on hand: $grand_total \n\n"; } #### Name wiggle; Internal SKU: 179; Source(s): mfg AMD; mfg's SKU: CDS00013; count: 100 mfg Intel; mfg's SKU: FOO00099; count: 42 total wiggle's on hand: 142 Name woggle; Internal SKU: 180; Source(s): mfg AMD; mfg's SKU: CDS00014; count: 102 mfg Intel; mfg's SKU: BAR00042; count: 99 total woggle's on hand: 201