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

Re: Many matches to an array

by Paulster2 (Priest)
on Jul 15, 2004 at 11:09 UTC ( [id://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.)

Paulster2


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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-18 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found