in reply to Re: how do you use the index function on this example?
in thread how do you use the index function on this example?
And you don't even need the capturing parentheses:
Note that @+ holds the positions of the first character after matched sub-strings!c:\@Work\Perl>perl -wMstrict -le "my $string = 'IIIIMMMMMMMOOOOOOOOOOMMMMMMMMMMMMMMMIIIIIIMMMMOOOO'; ;; while ($string =~ /M+/g) { my ($start, $end) = ($-[0], $+[0]); print qq{start $start, end $end}; } " start 4, end 11 start 21, end 36 start 42, end 46
Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom