use strict; use warnings; my %hash1 = ( 1=> ["You", "Me", "Him", "Her"], 2 => ["You", "Me", "Him", "Her"], 3 => ["You", "Me", "Him", "Her"]); my %hash2 = ( 1 => 3, 51 => 0, 32 => 1) ; foreach my $keys (keys %hash1){ if (defined $hash2{$keys}){ print join(' ',@{ $hash1{$keys} }), "\t", $hash2{$keys}, "\n"; } } #### You Me Him Her 3