Granted. With respect to the OP's case of reading a file, but I took Aristotle to mean that he advises using locally scoped lexical file handles for the general case.
I can't honestly claim that I usually check the return from close even on writable files. Little I'm doing is that critical at the moment, but I was wondering how you could handle the possibility of the error occuring with autoclosed filehandles?
As I said, I'm not sure it would be possible to do much about it beyond logging the fact that a failure had occured, but that could be important for tracking down failures in critical applications. I just can't see a way to go about it when auto-closing lexical handles.
In reply to Re: Re: Don't close filehandles (was: To Kill a Meme: while(defined($line = <>)) )
by BrowserUk
in thread To Kill a Meme: while(defined($line = <>))
by sauoq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |