Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Golf (Inspired): Repeated Phrases

by MeowChow (Vicar)
on May 10, 2001 at 20:40 UTC ( [id://79466] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    @l = repeated('this dog a round', 'this dog a pound', 1, 3);
    @l = repeated('this dog a round', 'this dog a pound', 1, 4);
    
  2. or download this
    sub repeated {
    ($s,$_,$m,$n)=@_;my@p;for$i($m..$n){$s=~$1&&push@p,$&while/\b(?=((\w+\
    +b ?){$i}))/g}@p
    }