#!/usr/bin/perl use strict; use warnings; use HTML::TableExtract; my $te; my $ts; my $html_string; my $filename='1385-AIM-Legal.aspx.html'; my $row; my $col; open(my $fh, '<', $filename) or die "cannot open file $filename"; { local $/; $html_string = <$fh>; } close($fh); my $headers = ['Phone']; $te = HTML::TableExtract->new(depth => 2); $te->parse($html_string); foreach $ts ( $te->tables() ) { foreach $row ( $ts->rows() ) { print join ( "\t", @$row ), "\n"; } }