in reply to Re: Don't close filehandles (was: To Kill a Meme: while(defined($line = <>)) )
in thread To Kill a Meme: while(defined($line = <>))
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Don't close filehandles (was: To Kill a Meme: while(defined($line = <>)) )
by Abigail-II (Bishop) on Nov 03, 2003 at 22:08 UTC |