http://www.perlmonks.org?node_id=476135


in reply to Re^2: How to close all open file descriptors after a fork?
in thread How to close all open file descriptors after a fork?

No they won't. Your array will still hold a copy and they all will be kept open.
I meant: "in a general situation". In this particular one I suggested to explicitly close the entries kept in the array. I also included a footnote mentioning the ref thing.
These file handles are references, are they not? You could try weaken these references in the array, and they'll automatically go away as normal — leaving just an undef in place.
This is a very interesting suggestion, although I have no experience myself weakening references. I won't try because this is not my problem, but I will keep it in mind for when it may be of some use for me...
  • Comment on Re^3: How to close all open file descriptors after a fork?