in reply to Re: Page Scraping
in thread Page Scraping

Akho, that kinda worked, but it retrieved the artist names instead of the butname= id #

Replies are listed 'Best First'.
Re^3: Page Scraping
by akho (Hermit) on May 01, 2007 at 21:18 UTC
    You could work this out yourself, but

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

    should help.

    Ask if you don't understand some parts of my script.

      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.

        We selected all links whose URL matches the regexp, then we loop through tnem. I'd say it always matches.