in reply to What happens when I use a filehandle
Another advantage to closing the filehandle yourself rather than allowing the garbage collector to close it for you, is that you can check the return status. If all buffers could not be flushed when the close occurs, the only way you will know is if you run the close and check the status, like this pseudo-code:
close (FH) or die "Could not write all data to $file_or_pipe: $!";
|
|---|