http://qs1969.pair.com?node_id=79476


in reply to Golf (Inspired): Repeated Phrases

Okay.... I was quite close with my original solution, but failed to fully test it. MeowChow pointed out the error in my approach; {$n,$m} will only match once, whereas I need it to match the whole range from $n to $m.

So, I just needed to add another loop, and voila:

sub repeated { ($_,$t,$n,$m,@p)=@_; for$i($n..$m){$t=~$1&&push@p,$&while/\b(?=((\w+\b ?){$i}))/g}@p }
So that's 83 characters long, with help from MeowChow's solution.