B
Brett
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!
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!