#!/usr/bin/perl -w
use LWP::Simple;
for $i (O..Q)
{
my $url="http://eoddata.com/stocklist/NASDAQ/".$i.".htm";
my $str = get($url) or die "Couldn't get it!" unless defined $str;
print "got\n";
my @array = ($str =~ m/.+?Chart for NASDAQ,\w+?">(.+?)<\/A><\/td>
(.+?)<\/td> | (\d+?\.\d+?)<\/td> | (\d+?\.\d+?)<\/td> | (\d+?\.\d+?)<\/td> | (\d+?,?\d+?,?\d+?)<\/td> | (-?\d+?\.\d+?)<\/td> | <\/td>| (-?\d+?\.\d+?)<\/td>.+?/gi);
open (FH,">","nasdaq_list_format".$i.".txt") or die "oops $!\n";
local $%=0;
local $-=0;
my $s= @array/8+5;
#FH->format_lines_per_page($s);
format FH_TOP=
SYMBOL Name High Low Close Volume Change +/-
-------------------------------------------------------------------------------------------------------------------------
.
format FH =
@<<<<< @<<<<<<< @###.##### @###.#### @###.#### @||||||||||| @###.### @##.##
$m,$n,$o,$p,$q,$r,$s,$t
.
while ( ($m,$n,$o,$p,$q,$r,$s,$t) = splice (@array,0,8)) {
write FH;
}
close(FH);
}
| |