my $fh; open $fh, "<$myFile" or die "blah"; myFunc($fh); sub myFunc { my $fh = shift; while(<$fh>) { # do something } }