in reply to Passing filehandles to subs.
First go out and read this explanation of what prototypes are in Perl.
Then drop them from your code entirely. It will be much improved for it...