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

Re: number of matches

by wufnik (Friar)
on Sep 02, 2004 at 21:53 UTC ( [id://388134]=note: print w/replies, xml ) Need Help??


in reply to number of matches

i am presuming you do not want *overlapping* matches;

ie you want simple repeat detection: if this is the case something like:
my $searchstring = 'humptydumpty'; my @matches = $searchstring =~ /umpty/g;
should work, leaving you able to access the number of matches by using scalar @matches or whatever
...wufnik

-- in the world of the mules there are no rules --

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-26 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found