in reply to perl html table extract to get data from two tables.

You're on the right track with your question. The mostly duplicate code that handles the two tables should probably be put into a subroutine which your main script can then call and pass the header array references to as an argument:
sub get_table { my $headers = shift; $table_extract = HTML::TableExtract->new(headers => $headers); $table_output = Text::Table->new(); $table_extract->parse_file($html); ($table) = $table_extract->tables; foreach my $row ($table->rows) { $table_output->load($row); print " ", join(',',grep defined, @$row),"\n"; print $ofh " ", join(',',grep defined, @$row), "\n"; } } # calling the sub for each table get_table( [ 'Status', 'Results', 'Schedule Name' ] ); get_table( [ 'Status', 'Results', 'Node Name' ] );
--Nick