sub newopen { my $path = shift; local *FH; # not my! open (FH, $path) || return undef; return \*FH; } $fh = newopen('/etc/passwd');