in reply to Extracted HTML table

This works for me (Win XP, Perl Activestate 5.8.8).
#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; use HTML::TableExtract; use WWW::Mechanize; $Data::Dumper::Indent = 1; my $url = "http://www.sailwx.info/shiptrack/cruiseships.phtml"; my $m = WWW::Mechanize->new(); $m->get($url); die unless $m->success; my $input = $m->content; my $te = HTML::TableExtract->new( headers => [qw(Ship position)] ) or die qq{$!}; $te->parse($input); foreach my $row ($te->rows) { print Dumper($row); }
outputs (extract)
$VAR1 = [ 'Carnival Freedom', "N 18\x{b0}30', W 077\x{b0}06'" ]; $VAR1 = [ 'Carnival Glory', "N 19\x{b0}24', W 064\x{b0}48'" ]; $VAR1 = [ 'Azamara Journey', "S 35\x{b0}06', W 056\x{b0}48'" ];

Replies are listed 'Best First'.
Re^2: Extracted HTML table
by mcoblentz (Scribe) on Mar 20, 2008 at 14:24 UTC
    Well, I'm scratching my head here. When I run any of the alternative queries based on "header" (ship position, etc.), I get an empty file. When I run the query based on table border, I get the ships.

    I don't make any other changes. Hmm. I'll keep looking.

    Thanks for checking.