open my $fh, "<", $input or die "$input: $!"; foo($fh); sub foo { my ($fh) = @_; my $line = <$fh>; print $line; }