my %Accountinfo; $Accountinfo{E200} = [200, 300, 400]; $Accountinfo{E400} = ["EFG"]; #Now , you can iterate through all stores for all accounts: for my $acct (sort keys %Accountinfo){ for my $store (@{ $Accountinfo{$acct} } ){ print "Account $acct has store $store\n"; } }