programming-examples/perl/File/Passing Filehandles by Reference.pl
2019-11-15 12:59:38 +01:00

11 lines
241 B
Perl

#!/bin/perl
open(READMEFILE, "f1") || die;
&readit(*READMEFILE); # Passing a filehandle to a subroutine
sub readit{
local(*myfile)=@_; # myfile is an alias for READMEFILE
while(<myfile>){
print;
}
}