http://qs1969.pair.com?node_id=840588


in reply to Re: Quicker way to compare these 2 strings?
in thread Quicker way to compare these 2 strings?

Ok, with some minor corrections it works just fine!
Thanks!
$first= "AAAAXXXXAAAAXXXXXXXXXXXAAAA"; $second="AXXXAXXAAXXXXXAAAAXXXXXAAAA"; $matches=0; for $i (0..length($first)-1) { if (substr($first,$i,1) eq substr($second,$i,1)) { $matches++; } } print $matches."\n";