in reply to look for substrings and getting their location

And, in the spirit of TIMTOWTDI, here's one without RegExes:
#!perl use strict; use warnings; my $seq = 'GUAUGUUUAACAGUGAUACUAAAUUUUGAACCUUUCACAAGAUUUAUCUUUAAAUAUGUUAUGA'; my $search = 'UUUAA'; my $max = length($seq) - length($search); my $i = 0; my @results; while ($i < $max) { $i = index($seq, $search, $i); if ($i == -1) { last; } else { push @results, $i; } ++$i; } print @results . " match(es)\n\n"; print " $seq\n"; for (@results) { printf "%02.2d: %s%s\n", $_, ' ' x $_, $search; }
It might be faster or not ;-).

Hope this helped.
CombatSquirrel.
Entropy is the tendency of everything going to hell.