foreach my $keys1 (sort keys %{$excel_hash}) { while (my ($key2, $value) = each %{%$excel_hash{$keys1} } ) { print "$key2 = $value \n"; } }