Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Golf (Inspired): Repeated Phrases

by chipmunk (Parson)
on May 10, 2001 at 19:51 UTC ( [id://79444]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub repeated {
    my@p;$_=pop()-1 for$m,$n;
    $_[1]=~($~=$1.$2)&&push@p,$~while$_[0]=~/(\w+)(?=(( \w+){$n,$m}))/g;
    @p
    }
    
  2. or download this
    sub repeated {
    my@p;$m=pop;$n=pop;
    $_[1]=~$1&&push@p,$&while$_[0]=~/\b(?=((\w+\b ?){$n,$m}))/g;
    @p
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://79444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-19 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found