in reply to Open file issues
All the files in your script share one filehandle, FILE. You have two options to solve this problem: use Symbol::gensym() to create unique filehandles, or use lexicals instead of bareword filehandles. The latter option requires you to have a new perl (5.6 or 5.8, I can't remember). The code would look like this:
my $fh; open($fh, "...") or die ...; return $fh;
In Section
Seekers of Perl Wisdom