perlquestion
neversaint
Dear Masters,<br>
<blockquote><i>
</i></blockquote>
Given pairs of string like this.
<code>
my $s1 = "ACTGGA";
my $s2 = "AGTG-A";
# Note the string can be longer than this.
# But they are always of the same length.
</code>
I would like to find position and character in in $s1 where it differs with $s2. In this case the answer would be:
<code>
#String Position 0-based
# First col = Base in S1
# Second col = Base in S2
# Third col = Position in S1 where they differ
C G 1
G - 4
</code>
I can achieve that easily with substr(). But it is horribly slow. Typically I need to compare millions of such pairs.
Is there a fast way to achieve that?
<br><br>
<div class="pmsig"><div class="pmsig-476719">
---<br>
<i>neversaint and everlastingly indebted.......</i><br>
</div></div>