in reply to Scraping with Treebuilder

Hi lv211,

Yes, it's because you have a couple of errors in your code:

    my @rows = map { $_->parent-parent } @links;

should be parent->parent.  And ...

    my @hrefs = $node->look_down( _tag => 'a' )

is missing a semi-colon ';' at the end.

That should make your code compile cleanly, anyway.  Good luck!


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Replies are listed 'Best First'.
Re^2: Scraping with Treebuilder
by lv211 (Beadle) on Jul 15, 2006 at 20:48 UTC
    Thanks liverpole.
      My pleasure :)

      By the way, I did notice, while trying to run your program, that I was getting an error with the URL you have:

      my $url = 'http:www.oreilly.com/catalog/prindex.html';

      It doesn't work for me in a browser, either (it's a missing or unavailable page).

      The reason I mention it is that the error message from Perl was somewhat cryptic ... so if you get an error retrieving that page, you may want to try another page which you're positive is accessible.


      s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/