Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: problem parsing html

by missingthepoint (Friar)
on Jul 16, 2009 at 09:09 UTC ( [id://780610]=note: print w/replies, xml ) Need Help??


in reply to Re: problem parsing html
in thread problem parsing html

I find using CSS selectors easier, in which case you stick with HTML::TreeBuilder::XPath and throw in HTML::Selector::XPath. Then:

my $selector = "#fiddlesticks li a"; my $tree = HTML::TreeBuilder::XPath->new(); my $xpath = HTML::Selector::XPath->new($selector)->to_xpath; my @nodes = $tree->findnodes($xpath); for my $n (@nodes) { print "Fiddlesticks Link: ", $n->attr('href'), "\n"; }

The zeroeth step in writing a module is to make sure that there isn't already a decent one in CPAN. (-- Pod::Simple::Subclassing)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-24 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found