Those are some pretty nasty tables (50 or so of them). All sorts of empty rows and cells embedded throughout. In cases like these, it's better to extract all tables and filter based on inspecting particular cells. For example:
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use HTML::TableExtract;
my $data = get('http://www.flalottery.com/exptkt/c3.htm');
my $te = HTML::TableExtract->new;
$te->parse($data);
for my $t ($te->tables) {
my $rc = -1;
my($d, $c) = $t->coords;
for my $r ($t->rows) {
++$rc;
@$r = map { s/^[^a-z0-9]//i; $_ }
grep { /[a-z0-9]/i }
grep { defined $_ }
@$r;
next unless @$r && $r->[0] =~ m/^\d+\/\d+\/\d+$/;
print "row $d:$c:$rc: ", join(':', @$r), "\n";
}
}
The grep/grep/map part eliminates empty cells and gets rid of the
entities that precede the M/E indicators. The 'next' statement afterwards eliminates empty rows and non-dated rows.
This is a shotgun approach. You could easily filter each row using specific column indexes, for example.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.