in reply to Re: TableExtract Module won't get complete first row!
in thread TableExtract Module won't get complete first row!

Thank you for that eloquent reminder. I did forget to paste my code. Apologies. Here it is.

my @bcfHeaders = [qr/Month\s*/, qr/First\s*/, qr/High\s*/, qr/Low\s*/, qr/Sett\s*/, qr/Chg\s*/, qr/Vol\s*/, qr/BWAVE\*\s*/, qr/Prev Vol\s*/, qr/Open\s*Int\s*/]; my $te = HTML::TableExtract->new( headers => @bcfHeaders, keep_headers => 1 ); $te->parse_file($filename); my ($ts, $row, $record); foreach $ts ($te->tables) { foreach $row ($ts->rows) { $record = join("\t", @$row); print $filehandle $record . "\n"; } }

Replies are listed 'Best First'.
Re^3: TableExtract Module won't get complete first row!
by Tanktalus (Canon) on Nov 15, 2005 at 17:21 UTC

    Ok, you're creating an array, @bcfHeaders, of one element: an arrayref. That arrayref has a bunch of stuff. Then you pass in the array to HTE's constructor where it expects a reference to an array. Two mistakes do make a right. Sometimes. That probably should be:

    my @bcfHeaders = (qr/Month\s*/, qr/First\s*/, qr/High\s*/, qr/Low\s*/, qr/Sett\s*/, qr/Chg\s*/, qr/Vol\s*/, qr/BWAVE\*\s*/, qr/Prev Vol\s*/, qr/Open\s*Int\s*/); my $te = HTML::TableExtract->new( headers => \@bcfHeaders, keep_headers => 1 );
    or you just change the @bcfHeaders to $bcfHeaders in your original code.

    All that said, I'm absolutely confident that this won't solve your real problem. Sorry.