Andrew_Levenson has asked for the wisdom of the Perl Monks concerning the following question:
I get the error "can't print on closed filehandle..." Thanks in advanced.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; }
Any ideas?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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Source Grabber
by diotalevi (Canon) on Mar 30, 2006 at 01:59 UTC | |
by Andrew_Levenson (Hermit) on Mar 30, 2006 at 02:30 UTC | |
by parv (Parson) on Mar 31, 2006 at 06:46 UTC | |
by diotalevi (Canon) on Mar 31, 2006 at 14:12 UTC | |
| |
|
Re: Source Grabber
by Cody Pendant (Prior) on Mar 30, 2006 at 00:42 UTC | |
|
Re: Source Grabber
by Cody Pendant (Prior) on Mar 30, 2006 at 01:07 UTC | |
|
Re: Source Grabber
by gri6507 (Deacon) on Mar 29, 2006 at 23:59 UTC | |
by Andrew_Levenson (Hermit) on Mar 30, 2006 at 00:05 UTC | |
by moklevat (Priest) on Mar 30, 2006 at 00:27 UTC | |
|
Re: Source Grabber
by wazoox (Prior) on Mar 30, 2006 at 11:02 UTC |