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.