use strict; use warnings; my $itemArea; my $itemPrice; my $itemId; my %thirdList; my $area; my $i; $itemArea = "0188"; $itemId = "0000007777"; $itemPrice = "40"; push @{ $thirdList{$itemArea} }, [ $itemArea, $itemId, $itemPrice ]; $itemArea = "0188"; $itemId = "0000009980"; $itemPrice = "41"; push @{ $thirdList{$itemArea} }, [ $itemArea, $itemId, $itemPrice ]; $itemArea = "0123"; $itemId = "0000008888"; $itemPrice = "50"; push @{ $thirdList{$itemArea} }, [ $itemArea, $itemId, $itemPrice ]; $itemArea = "0123"; $itemId = "0000009999"; $itemPrice = "51"; push @{ $thirdList{$itemArea} }, [ $itemArea, $itemId, $itemPrice ]; hardCodedPrint(%thirdList); sub hardCodedPrint { foreach $area ( keys %thirdList) { for ( $i=0; $i <= 1; $i++ ) { print "THIRD: "; print $thirdList{$area}[$i][0], " - "; print $thirdList{$area}[$i][1], " - "; print $thirdList{$area}[$i][2], "\n"; } } }