sub open { my ($direction,$filename)=@_; open my $h,$direction,$filename or return; # alternatively: or die "Can't open $filename: $!"; return $h; }