Try this:
use strict;
use warnings;
use HTML::TableExtract;
#Get HTML file and set up headers for HTML::TableExtract
my $doc = 'nasdaq-stocks.txt';
my $html = do{ local $/=undef; open my $f,"<", $doc or die $!;<$f>};
my $headers = ['Symbol', 'Last Sale*', 'Change Net / %', 'Share Volume
+'];
#table 4 is advances. Need to do again for 5 decliners
my $table_extract = HTML::TableExtract->new(count => 4, headers => $he
+aders);
$table_extract->parse($html);
print join (" \t",@$headers),"\n";
for my $r ($table_extract->rows()){
my @cols = map {/([\w\.]+)\W+([\w\.\%]*)/} @$r;
print join ("\t",@cols), "\n";
}
It would take a little work to put the "$" back in front of the "Last Sale*" amount, but this should get you started.
...it is unhealthy to remain near things that are in the process of blowing up. man page for WARP, by Larry Wall