my $fseq1= 'CCCCGCGC'; my @nsub1= ('CCCCG', 'CCCGC', 'CGCGC'); #produces $result1 = [ [ 0, 'C----' ], [ 1, '----C' ], [ 1, 'CC---' ], # but this is extra [ 2, '---GC' ] ]; #### my $fseq2= 'CCGCGCTC'; my @nsub2= ( 'CCGCG', 'CGCGC', 'GCGCT', 'CGCTC' ); #produces $result2 = [ [ 0,'C----' ], [ 1,'----C' ], [ 1,'C----' ], # extra [ 2,'----T' ], [ 2,'G----' ], # extra [ 3,'----C' ], ]; #### # So here we can observe that every element of the # array is only produced 'once' # E.g (0,1,2) versus (0,1,1,2) $result1 = [ [ 0, 'C----' ], [ 1, '----C' ], [ 2, '---GC' ] ]; # E.g (0,1,2,3) versus (0,1,1,2,2,3) $result2 = [ [ 0,'C----' ], [ 1,'----C' ], [ 2,'----T' ], [ 3,'----C' ], ];