in reply to returning filehandles

I don't know why people are telling you to use the IO modules. Personally I don't like the IO modules. Just remember that you have to actually put the filehandle into a variable before reading from it, and it is actually quite simple to have an array of filehandles. (If you use something more complex Perl will get confused and think it is a glob pattern or an expression.) See RE (tilly) 1: Merging files for a working example that does something useful.

Warning, there is usually a hard limit on how many filehandles you may have open. Often it is only a few hundred. Caveat programmer.

Trivia, in there I use Symbol so I can call gensym(). If you don't want to use the magic call to gensym(), on 5.6 the handle will create itself upon demand (ie it autovivifies), and in earlier Perl's you can do this:

my $fh = do {local *FOO};
to get the same effect.