#!/usr/bin/perl -w
use strict;
use HTML::TableExtract;
use DBI;
my $te = HTML::TableExtract->new();
$te->parse_file("arbitraryname.html");
my $table = $te->first_table_found;
my @totalrows;
push @totalrows, $_ foreach $table->rows();
my (@title, @teach, @aides);
foreach my $rownum (0..$#totalrows) {
# A cell can be called by $table->cell(row,column)
if ($table->cell($rownum, 0..2) =~ /\xa0/) {
s/\xa0\d+/ /;
} else {
s/\xa0//;
}
push @title, $table->cell($rownum, 0) ? $table->cell($rownum, 0) : '';
push @teach, $table->cell($rownum, 1);
push @aides, $table->cell($rownum, 2) ? $table->cell($rownum, 2) : '';
}
foreach my $ele (0..$#title) {
print "$title[$ele] - $teach[$ele] - $aides[$ele]\n"; # Testing output before I uncomment database section
=for comment
# inserting into a database, etc
=cut
}