Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Hits on a reg expression

by shenme (Priest)
on Sep 15, 2003 at 20:29 UTC ( #291645=note: print w/replies, xml ) Need Help??


in reply to Hits on a reg expression

First, are you using LWP::Simple ?   I can't tell from your example.   I'll assume so.   (ah, hope...)

LWP::Simple::get() will return just one string, containing all the returned lines, into your variable $content so pushing that value onto an array doesn't make sense.

You may count the instances of one string in another with something like this:

$n = () = $content =~ m/abcdef/g;
Reading from right to left, we ask the match operator to match multiple times, we then say we want it to act as though returning a list of all the matched strings, and then we say we _really_ just want the count of matched strings.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-11-27 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?