Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Many matches to an array

by Paulster2 (Priest)
on Jul 15, 2004 at 11:09 UTC ( #374607=note: print w/replies, xml ) Need Help??

in reply to Many matches to an array

Don't you want to put your entire content into an array and then check each line of that array for the content that you are looking for? It appears that you put all of the content into a string (or one element) then check that single element for your content. When you do that I would think that it would only return one hit. Change $content to an array and then search each line (foreach) for your content matches. That, I would think, will get you where you want to go. (I am assuming that the regex is correct.)


You're so sly, but so am I. - Quote from the movie Manhunter.

Replies are listed 'Best First'.
Re^2: Many matches to an array
by ciryon (Sexton) on Jul 15, 2004 at 11:38 UTC
    How do I put entire content into an array?
      maybe start with

      my @content = get_content($url); foreach my $var ( @content ) { next if $var =~ / undesirable regex /; $var =~ / your regex / && do something; .. }
      I think this is what Paulster2 means.. at least now the @content you fetched is going to get processed line by line..

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2020-11-24 10:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found