sub print_to_fh { my ( $ref_to_fh ) = @_; #$ref_to_fh is _not_ a filehandle. It's a scalar, that's a reference. my $filehandle = $$ref_to_fh; #Filehandle has dereferenced $ref_to_fh, so we can print to it now: print $filehandle "Some more text\n"; } open ( my $filehandle, ">", "testfile.txt" ); &print_to_fh ( \$filehandle ); close ( $filehandle );