perl -e '@a=qw(g a t c g a t c g a t c); for(1..1000000){$x=int(1000*rand());$s.=$a[$x]} while($s=~/(?\w{3,})\w*\g{repeat}/g){ $+{repeat};$c=()=$s=~/$+{repeat}/g;print "$+{repeat} : $c\n"}' agtcg : 0 agtcg : 0 agtcg : 0 ^C #### perl -e '@a=qw(g a t c g a t c g a t c); for(1..1000000){$x=int(1000*rand());$s.=$a[$x]} while($s=~/(?\w{3,})\w*\g{repeat}/g){ $+{repeat};$c=()=$s=~/$+{repeat}/;print "$+{repeat} : $c\n"}' : 1 : 1 : 1 : 1 #### perl -e '@a=qw(g a t c g a t c g a t c); for(1..1000000){$x=int(1000*rand());$s.=$a[$x]} while($s=~/(?\w{3,})\w*\g{repeat}/g){ $m=$+{repeat};$c=()=$s=~/$m/;print "$m : $c\n"}' gcacgt : 1 cga : 1 tggg : 1 ttg : 1 tta : 1 cct : 1 #### perl -e '@a=qw(g a t c g a t c g a t c); for(1..1000000){$x=int(1000*rand());$s.=$a[$x]} while($s=~/(?\w{3,})\w*\g{repeat}/g){ $m=$+{repeat};$c=()=$s=~/$m/g;print "$m : $c\n"}' gctgca : 0 gctgca : 0 gctgca : 0 ^C