in reply to PLEADE HELP ME!![NEWBIE]
If you massage your lists into strings of a form similar to "1, 2, 5, 1, 2, 5, 1, 2, 5, ", "3, 6, 3, 6, 3, 6, 3, 6, " etc., you can do
$rep++ while $seq =~ s/(.+?)\K\1//;
This successively removes a substring (.+?) followed by itself (\1), and counts (in $rep) how many times this can be done.
Note that this counts the number of repetitions, not occurrences (like, in "abcabc", "abc" is repeated once). If you rather want the number of occurrences, just add one...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PLEADE HELP ME!![NEWBIE]
by ikegami (Patriarch) on Dec 20, 2011 at 22:48 UTC | |
by Eliya (Vicar) on Dec 20, 2011 at 23:05 UTC |