HTML::TableExtract example

Steve Finkelstein <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Hi all,

I've completed this using regular expressions parsing out arbitrary data
between HTML tag, however I found a much more efficient route with the
HTML::TableExtract module which looks like it can very well shorten my code
and make it more manageable.  I'm able to parse out the entire table with
the following code:

#!/usr/bin/perl -w -t
# Development grounds for using HTML::TableExtract for songsearch.pl

use HTML::TableExtract;
use strict;

my $html = 'latest_rel.htm';

my $te = HTML::TableExtract->new( attribs => { border => 1 } );
$te->parse_file($html);

foreach my $ts ($te->tables) {
        foreach my $row ($ts->rows) {
                print "   ", join(',' , @$row), "\n";
        }
}

However, now I want to extract only the second column from this table (It
just consists of several rows with three columns).

Any hints would be greatly appreciated!

Thanks and have a great holiday weekend.


--
Steve Finkelstein
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.