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

Re^4: Page Scraping

by shigetsu (Hermit)
on May 01, 2007 at 21:36 UTC ( [id://613076]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Page Scraping
in thread Page Scraping

That doesn't catch cases when the regular expression doesn't match and hence $1 might have a value assigned to it from a previous successful capturing regular expression match.

I humbly suggest either:

print {$pro_list} $1, "\n" if $artist_link->url() =~ /(\d{9})/;
or
if ($artist_link->url() =~ /(\d{9})/) { print {$pro_list} $1, "\n"; }

The curly braces around {$pro_list} disambiguates its use as the filehandle that is printed to.

Replies are listed 'Best First'.
Re^5: Page Scraping
by akho (Hermit) on May 02, 2007 at 08:19 UTC
    We selected all links whose URL matches the regexp, then we loop through tnem. I'd say it always matches.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-24 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found