$VAR1 = { '99155' => { 'PR' => [ 'state_name=Puerto Rico', 'county_names_all=Adjuntas|Utuado', ], 'AK' => [ 'state_name=Alaska', 'county_names_all=Ketchikan Gateway|Prince of Wales-Hyder', ], 'WA' => [ 'state_name=Washington', 'county_names_all=Pend Oreille|Spokane|Lincoln|Adams', 'comments=America/Los_Angeles' ] }, '26134' => { 'WV' => [ 'state_name=West Virginia', 'county_names_all=Wirt|Wood|Jackson|Ritchie|Calhoun', 'comments=America/New_York' ] } }; #### for my $outerkey (keys %hash) { for my $innerkey (keys $hash{$outerkey}) { print join(', ', @{ $hash{$outerkey}{$innerkey} } ); push( @{ $hash{$outerkey}{$innerkey} }, @array); } }