in reply to Comparing 2 different-sized strings
Something like this should work:
my $s1='TCGAGTGGCCATGAACGTGCCAATTG'; my $s2='ATGATCCTG'; ($s1,$s2) = ($s2,$s1) if length($s1) > length($s2); my $loc = index $s2, $s1; if ($loc<0) { print "String not found!\n"; } else { print "String found at location $loc\n"; }
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing 2 different-sized strings
by Laurent_R (Canon) on Aug 08, 2013 at 17:16 UTC |