my $file; { open(my $fh, '<', ...) or die ...; local $/; $file = <$fh>; }