in reply to Complicated pattern match
perl -e'$_=q#: 13_2: 12/"{>: 8_4) (_4: 6/2"-2; 3;-2"\2: 5/7\_/\7: 12m m::#;s#:#\n#g;s#(\D)(\d+)#$1x$2#ge;print'#!/usr/bin/perl -l my $A = 'ATGGAGTCGACGAATTTGAAGAAT'; my $B = 'xxxxxxATGGAGyxxxTCGAzxxxxCGAATTTGAAxxwGAAT'; my ($An, $Bn) = (0, 0); # relative indices my ($Ac, $Bc); # characters my ($difpos, $difstr) = (0, ''); # keep track of differences for $Bn (0 .. length($B)-1){ $Ac = substr($A, $An, 1); $Bc = substr($B, $Bn, 1); if ($Ac eq $Bc){ print "$difpos: $difstr" if $difstr; $difstr = ''; $An++; $difpos++; } else { $difstr .= $Bc; } }
|
|---|