How to pass a filehandle to a subroutine?
- I am trying to pass a filehandle to a subroutine but cannot get the
syntax right. I have been reading about using 'prototypes' but
something isn't sinking in... the test code below is the result of
that research - it will not work with or without 'use strict' - I
would prefer to keep 'strict'.
Any help is gratefully appreciated
open FH, ">mydat.txt";
my $MYFILE = shift @_;
print $MYFILE "Filehandle was passed!";