HTML::TableExtract is beautiful
HTML::TableExtract 可以把 HTML 檔案理的 table 內容取出,非常方便。
Example:
#!/usr/bin/env perl use strict; use warnings; use HTML::TableExtract; my $te = HTML::TableExtract->new( attribs => { id => 'tbl' }, ); # local copy of # http://bea.gov/iTable/iTableHtml.cfm?reqid=9&step=3&isuri=1&903=58 $te->parse_file('personal-income.html'); my ($table) = $te->tables; for my $row ($table->rows) { my ($undef, $label, @row) = @$row; next unless defined $label; if ($label eq 'Unemployment insurance') { print "$label\t@row\n"; } }