in reply to Comparing two sets

Untested:
my %lines = map {($_, 1)} qw [One Two Three]; my %hash = qw [One 1 Two 2 Three 3 Four 4]; foreach my $key (sort {$hash{$a} <=> $hash{$b}} keys %hash) { print "$key,", $hash{$key}; print $lines{$key} ? ",Hit\n" : ",Miss\n"; }