kalyanrajsista has asked for the wisdom of the Perl Monks concerning the following question:
Hello all
I'm trying to extract data from HTML Tables.
If I've specified the headers in object creation, do I need to mention
$ts[0]->rows
explicitly
or is there any otherway to get the data, since I'm trying to match only one table with the headers specified...
use strict; use HTML::TableExtract; #Content contains actual HTML code extracted from webpage my $content; # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #Please assume that content has some data # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ my $te = HTML::TableExtract->new(headers => ['Name', 'Place', 'Country +', 'Telephone']); my @ts = $te->parse($content)->tables; my @data = $ts[0]->rows; print Dumper(@data);
$VAR1 = [ 'Justin', 'California', undef, '12345' ]; $VAR2 = [ 'Catherine', 'Texas', 'USA', '2419422' ];
Am I doing anything wrong
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extract HTML data
by stefbv (Priest) on Dec 10, 2009 at 16:16 UTC | |
by kalyanrajsista (Scribe) on Dec 11, 2009 at 11:11 UTC |