in reply to PLEADE HELP ME!![NEWBIE]

You didn't say whether you wanted just the -largest- number of consecutive matches, or all. And I'm only theorizing that you want to exclude instances where there are consecutive matches but they don't go all the way to the end of the string. Not enough information. But here:

use strict; use warnings; my ($i, $j); while (<DATA>) { chomp; @_ = split /, /; OUTER: for $i (1..(($#_+1)/2)) { next if ($#_+1) % $i != 0; for ($j = $i; $j <= $#_; $j += $i) { next OUTER if "@_[0..($i-1)]" ne "@_[$j..($j+$i-1)]"; } $j = ($#_ + 1) / $i; print "@_ = $i of $j-chunks\n"; } } __DATA__ 1, 2, 5, 1, 2, 5, 1, 2, 5 3, 6, 3, 6, 3, 6, 3, 6 4, 1, 28, 0, 4, 1, 28, 0 3, 5, 17, 3, 17, 5 4, 1, 28, 0, 4, 1, 28