in reply to splitting a string
It may be that you are looking for something like:
use strict; my $seq = '------------GGATCC________________GGATCC=============GGATCC ++++++++++'; my @splits = (0); push @splits, pos $seq while $seq =~ /(?=GGATCC)/ig; push @splits, length $seq; for my $index (0 .. $#splits) { my $width = $splits[$index + 1] - $splits[$index]; print substr ($seq, $splits[$index], $width), "\n"; }
Prints:
------------ GGATCC________________ GGATCC============= GGATCC+++++++++
However it's a bit hard to tell because you include uninteresting rubbish in your sample that means it is unrunnable, but you don't include any sample data and you don't show the result you would actually like.
|
|---|