programming-examples/perl/Subroutine/Pass file handle global reference to a subroutine.pl
2019-11-15 12:59:38 +01:00

8 lines
162 B
Perl

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