469,917 Members | 1,891 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Problem with arrays or possibly HTML::Element

Hello All,

I'm trying to parse through a webpage, and I used HTML::treebuilder to
try to get it into an easily managable data structure. I am having a
bit of trouble parsing through it though.

Here is a snippet of code:

$tree = HTML::TreeBuilder->new;
$tree->parse($response->content);
$tree->eof();
my @tables = $tree->look_down("_tag", "table");
my $root = $tables[0]; # Move to first table
@tables = $root->look_down("_tag","tr");
$root = $tables[2]; # Move to third row
The problem is, at the end of this snippet if I dump the contents of
$root I get the FIRST row of the table, rather than the third.
Somehow it always assigns the first element of the table instead of
the one I specify in the brackets.

If anyone has an idea about what I'm doing wrong I would really
appreciate it. I was asked to write this script for a professor's
research and I am late on delivering it!
Jul 19 '05 #1
0 1308

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Björn | last post: by
3 posts views Thread by jonjon | last post: by
3 posts views Thread by Halo | last post: by
3 posts views Thread by Jim Heavey | last post: by
2 posts views Thread by petermichaux | last post: by
reply views Thread by matthewr | last post: by
1 post views Thread by dave | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.