Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: find a string a certain number of times

by AJRod (Scribe)
on Jan 30, 2005 at 01:02 UTC ( [id://426320]=note: print w/replies, xml ) Need Help??


in reply to find a string a certain number of times

It depends on what you mean by checking "if a particular string occurs a certain number of times in the array":

1. You may want to count the absolute number of occurences of the string in the array. Meaning, you count three if array element 52 contains three occurences of the string. In this case, you use the suggestion of gaal above.

2. On the other hand, you may want to count the number of array elements which test positive on the occurence of the string, regardless of how many strings each array element contains. Meaning, you count only once even if array element 52 contains three occurences of the string. In this case, you use the suggestion of foil above.

  • Comment on Re: find a string a certain number of times

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-19 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found