in reply to 'grouping' substrings?

I'd make use of Perl's @- and @+ arrays produces by regexes:
my $seq = "..."; my @groups; push @groups, [$-[0], $+[0]] while $seq =~ /M+/g; print "$_->[0] to $_->[1]\n" for @groups;
This gives me different values than you've shown, but I believe it's correct.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: 'grouping' substrings?
by Anonymous Monk on Feb 01, 2006 at 16:15 UTC
    Yes, don't mind what I wrote, it was just an example... will try your code ASAP. Will also check index function.. thanx to both of you!
      Sorry to bother you again, but it doesn't seem to work. For example, the first group gives 5-16, while it should be 5-15, the second 32-45, while it should be 32-44 from what I can calculate... Are my maths poor??? Also, I can't understand what [$-[0], $+[0]] mean... Any tips ? Sorry, I'm just beggining Perl...
        I hope this isn't too obvious, but how about subtracting one from $+[0]?

        Updated per ikegami's reply - duh! I have a bad track record lately...

        [ ... ] means "Construct an array with '...' as content, and return a reference to it." This is documented in perlref.

        $-[0] and $+[0] are elements of the special arrays @- and @+. Refer to perlvar for more information.