In order to manage an array of file handles, your code will be much cleaner and clearer if you use FileHandle (which is part of the core distribution -- every perl installation has it). This way, you get to use normal scalars that are references to file handles. It's just nicer.