rovf has asked for the wisdom of the Perl Monks concerning the following question:
{ ... { *local HANDLE; open(HANDLE,">outfile.txt"); print HANDLE "...."; } }
In the code above, is it guaranteed by perl that the file handle will be properly closed at the end of the inner block? I think so, and in my tests, it always worked out that way, but I got reports from a co-worker (who uses a different perl version from mine, 5.8.8, on Windows) that the buffer is occasionally not flushed at the end of the block and that he ended up with an empty file.
I was believing that when HANDLE goes out of scope (and there are no references to it alive anymore), perl would do an implicit close(HANDLE)
--
Ronald Fischer <ynnor@mm.st>
Ronald Fischer <ynnor@mm.st>
Back to
Seekers of Perl Wisdom