in reply to Re: Identifying unmatched data in a database
in thread Identifying unmatched data in a database
Most esteemed prior, a humble pilgrim seeks to barge in and benefit from your wisdom.
you should get into the habit of [...] calling close on the filehandle when the file is no longer being used, and always checking open and close for success or failure
I hear your advice, but I don't understand why these are good habits.
I always regarded calling close as superfluous, unless I was either a) going to open the same file again (perhaps with different parameters, perhaps not), or b) concerned that the system itself would run out of file descriptors for open files (or perhaps c) opening pipes rather than files, but I've never done that). What does explicitely calling close -- much less at the very end of a script, with no further code following it -- accomplish?
On the same note, while it's of course always a good idea to check for errors, what would an inability to close a file signify for the script? I assume that the worst that could happen is that the file remains open; if close is not necessary to begin with, as above, this would not be a problem (since not calling close would leave the file open, anyway). Even if an explicit close is advisable, I'd expect that failure would at most warrant a warning in most situations.
But I'm not an experienced monk of Perl. Please enlighten me, brother!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Identifying unmatched data in a database
by hippo (Archbishop) on Jun 29, 2014 at 11:16 UTC | |
by soonix (Chancellor) on Jun 29, 2014 at 20:34 UTC | |
|
Re^3: Identifying unmatched data in a database
by Athanasius (Archbishop) on Jun 29, 2014 at 14:57 UTC | |
|
Re^3: Identifying unmatched data in a database
by Laurent_R (Canon) on Jun 29, 2014 at 15:24 UTC |