{ ... { *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)
In reply to Implicit closing of files by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |