my $x; { open my $fh, '<', '/path/to/foo.file' or die $! $x = <$fh>; close $fh; }