http://qs1969.pair.com?node_id=291645


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.