in reply to
How to close all open file descriptors after a fork?
Maybe this is not what you want. But why don't you open all of your FDs as "lexical FHs" (recommended in any case, IMHO) and push them into an @array. You can later close $_ for @ARRAY if needed. (I prefer "lexical FHs" because they will automatically closed on scope exit1 - I'm aware that sockets require an explicit close, though.)
- The &-form of sub call is now obsolete and most likely not to do what one expects in most situations unless one really knows what he is doing.
- C-style for loops are legal, but are more error-prone and less reliable, not to say clear, than the corresponding perlish construncts.
1 Or more precisely when no more references exist.