in reply to Filehandles question

Depending on how exactly this is coded, this may or may not be a problem.

1. You don't have to worry about leaking filehandles. The operating system will free resources used by the process. This is true for any OS I can think of that perl runs on.

2. You may be bitten by bufferring, because your output is not flushed to the file before the script ends.

3. On non-regular files, the close system call can fail. If you don't close the file yourself, you get no indication of this.

It's generally considered good practice to close the files, even if none of the above gives you particular reason to worry. (It sounds like #2 might, though.) Some reading: "Suffering from Buffering?", Catching errors in closing lexical filehandles.

Replies are listed 'Best First'.
Re^2: Filehandles question
by thor (Priest) on Dec 10, 2004 at 12:40 UTC
    On non-regular files, the close system call can fail. If you don't close the file yourself, you get no indication of this.
    It can fail on regular files, too. If the file system fills up between when the system last flushed your results and now, your close will try to write all the data that's in the buffer to the file and fail.

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come