programming-examples/perl/File/Pass file handle reference to a subroutine.pl

16 lines
188 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
sub printem
{
my $file = shift;
while (<$file>) {
print;
}
}
open FILEHANDLE, "<file.txt" or die "Can not open file";
printem *FILEHANDLE;