for my $id ( sort keys %{ $hashref1 } ) { ## extract an array of results for that key from each hash my %results1 = %{ $hashref1->{ $id } }; my %results2 = %{ $hashref2->{ $id } }; my %results3 = %{ $hashref3->{ $id } }; ## join them together with spaces ## and print them along with the key printf "%14s : %s \t%s\t%s\n", $id, join( ' ', %results1 ), join( ' ', %results2 ), join( ' ', %results3 ); }