Passing file handles to functions
#!/usr/bin/perl use warnings; use strict; my $file = "yourFile.txt"; open( FILE, $file ) or die( "Error opening $file: $!" ); my $filehandle = *FILE; readhandle( $filehandle ); close( FILE ) or die( "Error closing $file: $!" ); sub readhandle { my $fh = shift(); print while ( <$fh> ); }