in reply to returning filehandles

I think the easiest approach is to use the IO::File module.

You'll also want to review How can I make a filehandle local to a subroutine? How do I pass filehandles between subroutines? How do I make an array of filehandles? from the Perl FAQ. (The FAQ recommends the FileHandle module, which is now just a front end to the IO:: modules.)