sub comNucCount { my($string1, $string2) = @_; $string1 = lc $string1; $string2 = lc $string2; # we assume that the strings have the same length my($length) = length($string1); my($position); my($a,$c,$g,$t) = "0"; for ($position=0; $position < $length ; ++$position) { if(substr($string1,$position,1) eq substr($string2,$position,1)) { if(substr($string1,$position,1) eq 'a'){$a++} if(substr($string1,$position,1) eq 'c'){$c++} if(substr($string1,$position,1) eq 'g'){$g++} if(substr($string1,$position,1) eq 't'){$t++} } } return "A=$a, C=$c, G=$g, T=$t"; }