Skip to content

Instantly share code, notes, and snippets.

@takaki
Created January 14, 2013 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takaki/4528092 to your computer and use it in GitHub Desktop.
Save takaki/4528092 to your computer and use it in GitHub Desktop.
HTML::TableExtract sample
#!/usr/bin/perl
use strict;
use HTML::TableExtract;
use Data::Dumper;
my $html = "<table>" .
"<tr><td>" .
"<table><tr><td>1</td><td>a</td></tr><tr>".
"<td>2</td><td>B</td></tr></table>" .
"</td></tr>" .
"</table>";
my $te = HTML::TableExtract->new(depth=> 1, count=>0);
$te->parse($html);
my @rows = $te->rows;
foreach (@rows){
print $_->[0], ",", $_->[1], "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment