Seconded on using a lexical to hold your filehandle, although foo( \*HANDLE ) would do in a pinch (just remember that the filehandle "slot" for a print statement needs to be a simple scalar variable; you would need to use a block (print { $var[$index] } "Blah\n") or store something more complicated in a temp scalar otherwise).
Having said that, something else in your code jumps out as meriting comment: you really don't want to be using prototypes; they're meant for making subs perform like builtins, not for declaring number-of-arguments. If you really want behavior more like what's normally referred to as prototypes in other languages look at something like Params::Validate.
In reply to Re: passing a file handle to a subroutine
by Fletch
in thread passing a file handle to a subroutine
by kevind0718
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |