for my $old_doc(keys %doc_type_header){ print $old_doc,"\n"; for my $element(@{$doc_type_header{$old_doc}}){ print "\t",$element,"\n"; } }