HTML::TableExtract doesn’t work

By Shicheng Guo

The input html is attached (my $file), With the following script, I cannot extract the table I want. Any suggestions?

use strict;
use warnings;
use HTML::TableExtract;
my $file="view-source_www.nasdaq.com_dividend-stocks_dividend-calendar.aspx_date=2017-Apr-19.html";
open DATA,$file || die "cannot";
my $content;
{
    local $/ = undef; # slurp mode
    $content = <DATA>;
}
close DATA;
my $te;
$te = HTML::TableExtract->new( headers => [qw(Announcement_Date)] );
$te-> parse($content);
# Examine all matching tables
foreach my $ts ($te->tables) {
  print "Table (", join(',', $ts->coords), "):n";
  foreach my $row ($ts->rows) {
     print join(',', @$row), "n";
  }
}

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273