in reply to Re: Why do we need to close filehandles?
in thread Why do we need to close filehandles?

Personally if I don't close a file it does not feel right - a bit like walking out the door without my trousers on.
Yeah, but you still didn't flush.

Why do feel dirty if you don't close the file yourself (instead of having Perl do it for you), but you're fine with Perl doing the flushing (and syncing) for you? And do you close STDOUT and STDERR?

I close my handles when I want to inform the user of a possible error - else I let Perl (or the OS) take care of it for me.

  • Comment on Re^2: Why do we need to close filehandles?

Replies are listed 'Best First'.
Re^3: Why do we need to close filehandles?
by Anonymous Monk on May 01, 2011 at 20:56 UTC

    I know what he means; I had to double check the zipper myself until I learned to trust that leaving the scope of the bathroom would ensure it for me.

    Part of the issue might be being used to places where there are no bathroom walls, and bits are deposited just anywhere.