Hi,
I'm trying to write some code, that reads the IAN.com datafeed, this is the file:
..the code I'm using it:
..however, ALL of the data comes up on one line :/
I managed to fix it with this:
..but this doesn't work on large files (cos it just times out, and buggers up my server, as its doing a search on every single charachter, on a 40mb+ file
)
Does anyone have any suggestions?
TIA!
Andy
I'm trying to write some code, that reads the IAN.com datafeed, this is the file:
..the code I'm using it:
Code:
open(GRAB, "<$datafile") || die "Error reading $datafile. Reason: $!";
my $i = 0;
while (<GRAB>) {
$i++;
chomp;
print $_ . "\n";
unless ($i % 1000) { print " $i"; }
unless ($i % 10000) { print "\n"; }
}
close(GRAB);
..however, ALL of the data comes up on one line :/
I managed to fix it with this:
Code:
# just a custom cleanup routine.. seeing as IAN.com don't seem
# to want to fix up their database at their end :(
sub clean_string {
my @rules_test =split //, $_[0];
my $back;
foreach (@rules_test) {
$back .= $_ unless ord($_) == 0;
}
return $back;
}
..but this doesn't work on large files (cos it just times out, and buggers up my server, as its doing a search on every single charachter, on a 40mb+ file
Does anyone have any suggestions?
TIA!
Andy