473,503 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1382

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4572
by: Björn | last post by:
Hello, Starting to code a robust routine to add two arrays element by element $new = $a + $b ... I thought that this should already be done and searched CPAN for a sutiable module. Despite...
3
11807
by: jonjon | last post by:
Hi, Is there any way of adding a property to an HTML element ? I heard about the "prototype" method but it doesn't work for HTML elements such as Images, or Paragraphs... Netscape implements...
2
11278
by: Gary | last post by:
Hi, I am developing desktop application. In the desktop application am loading a html page, i want to acces html element value from C# code. Can anyone help me? how to access a html element or...
3
12707
by: Halo | last post by:
I have a HTML text box (NOT a TextBox server control) in a .aspx page and a button server control. Is it possible with ASP.NET to get the value of the HTML text box when I click the button? How...
3
1336
by: Jim Heavey | last post by:
If I have an HTML element, say a <p> tag with and ID="Fred", how do I find that element? I want to set the Style attribute to "hidden", how do I do that? Thanks!!!
2
1314
by: petermichaux | last post by:
Hi, I'm trying to remove an html element in the example below. I don't see the "bye" message at the end and there are no errors reported in Firefox or exceptions caught if I wrap the remove...
1
1155
by: oranmeir | last post by:
What i want actually is that when i right click on an element in my HTML file, select "properties" and then build the style of that html element, i want that the details about the position, colors...
0
1426
by: matthewr | last post by:
Hi, I can append children to an HTML element in a WebBrowser control (.NET 2.0) using the appendChild method. However, how can I remove a child element? Thanks, Matthew
1
1459
by: dave | last post by:
I encounted this at work today and wondering if anyone here has insight. We do this JS: <script type="text/javascript"> url = "www.servername.com" <script> the html element is:
7
2455
by: Zhang Weiwu | last post by:
Dear all How does javascript realiablily tell if a variable is a reference to an HTML Element "<select>", without causing browser to pop up error message? if (variable.constructor ==...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5576
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.