in reply to Novice Quiz: File is created locally, uploaded empty
One way of solving it is by using an autovivified scalar as handle:
then when $output goes out of scope, that is, when the for block reaches the end, the file is automatically closed.for (@files) { ... stuff ... open my $output => ">", $filename or die "...."; print $output $built; push @built => [$filename => $_]; }
It is slightly better to do an explicit close yourself, as that allows you to inspect the return value of close. A close might fail (filesystem full, for instance).
-- Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 2: Novice Quiz: File is created locally, uploaded empty
by tilly (Archbishop) on Jun 22, 2001 at 05:04 UTC | |
|
Re: Re: Novice Quiz: File is created locally, uploaded empty
by John M. Dlugosz (Monsignor) on Jun 23, 2001 at 01:09 UTC | |
by Abigail (Deacon) on Jun 25, 2001 at 19:08 UTC |