The result is 1 more than the length of the longest capture.
Why? If the full string is "123", then the result should be 3. If it's "21234", then the result should be 4. Still need to take overlaps into account even if you just want the length.
Btw, still have the typo in your last bit of code where you use min instead of max.
my $longest = min map length,
In reply to Re^4: Find Length Of Longest Ascending/Descending Sequence
by wind
in thread Find Length Of Longest Ascending/Descending Sequence
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |