Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Golf (Inspired): Repeated Phrases

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


in reply to Re: Golf (Inspired): Repeated Phrases
in thread Golf (Inspired): Repeated Phrases

I don't think this works quite right. Compare the output from the following two runs:
@l = repeated('this dog a round', 'this dog a pound', 1, 3); @l = repeated('this dog a round', 'this dog a pound', 1, 4);
UPDATE: Here's an 85-byte version that returns all the matches:
sub repeated { ($s,$_,$m,$n)=@_;my@p;for$i($m..$n){$s=~$1&&push@p,$&while/\b(?=((\w+\ +b ?){$i}))/g}@p }
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79466]
help
Chatterbox?
[Corion]: virtualsue: Aaah, yes, we do use these a lot
[1nickt]: Discipulus Yes, I think it is maybe easier to be a good monk in "real" life when you are young and idealistic or old and weary ... nost so much in middle age.
[1nickt]: 😲 ... or did you mean the Middle Ages, when monastic life was more, umm, "earthy" ?!

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2017-12-13 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (368 votes). Check out past polls.

    Notices?