I'm writing twin programs; one to store the source codes of a list of websites, and the other to use the stored info to tell me whether or not the website has been updated since last stored. I can't get the storing program to work, though, and can't figure out why.
use strict;
use warnings;
use LWP::Simple;
my @list;
my $source;
my $i;
my $file="C:/Documents and Settings/Dad/Desktop/url checker.txt";
open FILE, "<$file";
while(<FILE>){
push @list, $_;
}
close FILE;
my $length=length(@list);
for($i=0; $i<=$length; $i++){
my $j=$i+1;
$source=get($list[$i]);
open LOG, ">C:/Documents and Settings/Dad/Desktop/Websites/Website
+ Source[$j].txt";
print LOG $source;
close LOG;
}
I get the error "can't print on closed filehandle..."
Thanks in advanced.
-edit
Now it works fine except for that it only logs the sources of 3 websites, out of a list of 13.
use strict;
use warnings;
use LWP::Simple;
my @list;
my $source;
my $i;
my $file="C:/Documents and Settings/Dad/Desktop/url checker.txt";
open FILE, "<$file" || die "Can't open the list of urls! \n";
while(<FILE>){
push @list, $_;
}
close FILE;
my $length=length(@list);
for($i=0; $i<=$length; $i++){
my $j=$i+1;
$source=get($list[$i]);
open LOG, ">C:/Documents and Settings/Dad/Desktop/Websites/Website
+ Source $j.txt" || die "Can't open website sources.txt: $!\n";
print LOG $source;
close LOG;
}
Any ideas?