$l = length($string1); while ($l--) { $i += 1 if (substr($string1, $l, 1) eq substr($string2, $l, 1)) } print "$i identities.\n";