in reply to Re^2: Hash - Compare - Multiple value keys
in thread Hash - Compare - Multiple value keys

So what's the purpose of $found?

If all you need is to find out if this line matches criteria and do something based on that, that's pretty well what "if" statements are for...

foreach $1 (sort keys %file1){ foreach my $position1 (@{$file1{$1}}){ foreach $contig_id(sort keys %hash_1){ foreach my $position (@{$hash_1{$contig_id}}){ if($1 =~ /^$contig_id/ && $contig_id=~ /^$1/ && $posit +ion1==$position) { print RESULTS "$position1\t$1\n"; } else { print "not matched\n"; } } } } }

Mike