Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Hits on a reg expression

by shenme (Priest)
on Sep 15, 2003 at 20:29 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-25 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found