Pass file handle global reference to a subroutine
sub printhello { my $handle = shift; print $handle "Hello!\n"; } open FILEHANDLE, ">file.tmp" or die "Can't open file."; printhello(\*FILEHANDLE);