sub foo { defined($file = ) or return; open(FH, $file) or die $!; ... }