in reply to PLEADE HELP ME!![NEWBIE]
I submit this because it was fun. It works for me, and is intentionally ugly:
use strict; use warnings; while(<DATA>){ my$max=0; s/$/, /; my$x=()=/,/g; for my$n(1..$x){ if(/^((?:\d+, ){$n})\1+$/){ $max=$n;last; } } print$/,($max>0?$x/$max:0); } __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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PLEADE HELP ME!![NEWBIE]
by Anonymous Monk on Dec 21, 2011 at 16:54 UTC | |
by runrig (Abbot) on Dec 21, 2011 at 17:02 UTC | |
by hbm (Hermit) on Dec 21, 2011 at 19:02 UTC |