in reply to Re: Quicker way to compare these 2 strings?
in thread Quicker way to compare these 2 strings?
$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";
|
|---|