Given pairs of string like this.
my $s1 = \"ACTGGA\"; my $s2 = \"AGTG-A\"; # Note the string can be longer than this.
I would
Use binary bit ops on the complete strings.
Things like $s1 & $s2 or $s1 ^ $s2 run incredibly fast, and work with strings of arbitrary length.
$s1 & $s2
$s1 ^ $s2