in reply to Why do we need to close filehandles?
Most of the time you'll be fine if you don't explicitly close your find handles.
However, if you do any further operations on that file before closing, you could end up with unexpected results.
There was actually a case recently where someone was trying to serve a dynamic pdf from apache. They wrote it to a file and then had apache serve the file. Unfortunately, they didn't close the file handle before passing it to apache so their downloaded pdf was always malformed.
The lesson is always close your file handles and/or use lexical file handles so they are closed when they go out of scope.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why do we need to close filehandles?
by tej (Scribe) on Apr 30, 2011 at 08:35 UTC | |
by Anonymous Monk on Apr 30, 2011 at 09:16 UTC |