sub subroutine { my $fh = shift; print $fh "Hello, filehandle!\n"; } my $dest; open my $fh, '>', \$dest; subroutine($fh); close $fh; print "\$dest is '$dest'";