in reply to Re: Re: next if loop
in thread next if loop
Is there really any use to catching errors from close?
I believe there is, when the file was opened for output. The output buffer may not be flushed until the close. If the close fails, it could be indicative of a failure to flush the buffer, and thus, the file output may be incomplete or otherwise corrupted. This can happen due to a number of reasons. Someone may have taken the floppy out of the drive prematurely, the HD may have filled up, the CD may not have burned properly, the dialup connection (on an open socket) may have terminated early, etc.
In such an event, I would want to know about it, rather than have a silent failure.
My habit is to always put the 'or die "$!\n";' after closing an output file. I don't worry too much about the success of closing an input file.
Dave
|
|---|