|
|
 |
Re: FN-FORUM Perl Loop
date posted 18th January 2003 18:18
On Sat, 2003-01-18 at 16:17, [EMAIL REMOVED] wrote:
> Heres one for any perl experts...
>
> have written a script that extracts weather data from an email,
> writes it to files and then draws some graphs.
> It works fine but I now need to tidy it up as there are a few extra
> additions to the script that will make it excessively large (already
> 140k +). So was wondering if anyone could get the list below into a
> loop, this I could then apply to another 7 examples inside the script.
for(my $i = 0; $i < 24; $i++) {
if(open(IN, "/home/sites/www.dlharbour.ie/web/dlharbour_data/pressure_24/${i}.txt")) {
$pressure[$i] = ;
close(IN);
} else {
warn "Could not read /home/sites/www.dlharbour.ie/web/dlharbour_data/pressure_24/${i}.txt
";
}
}
Does this do what you want to do? Seems you never close all those file
handles - are you reusing them further down, or did you just forget? ;-)
Hope this helps!
Regards
Jan
--
Jan Bruvoll [EMAIL REMOVED]
|
 |
|