# Method 1 my @a1 = split //, $ref_seq; my @a2 = split //, $test_seq; $score += ($a1[$_] eq $a2[$_]) for 0 .. $#a1; # Method 2, Destructive $score += (chop $ref_seq eq chop $test_seq) while $ref_seq;