##
while ($sequence_string =~ /(.)\1{$threshold,}|(.{2,3}?)\2{$threshold,}|(.{4,6}?)\3{$threshold,}/g)
####
$i = 1;
while ($i < $genome_length)
{
for ($j=1;$j<=6;$j++)
{
# run regexp looking for motifs of length $j
# starting at position $i
}
$i = (end of previous match + 1)
}