my $orig = ; my $i = 0; while () { my $matches = $orig ^ $_; printf "Sequence %d has %d identities\n", $i++, $matches =~ tr/\0//; } __DATA__ ATCGGGACG TCGTCAGCG ATGCGAAAA #### Sequence 0 has 2 identities Sequence 1 has 4 identities