I have a small text file that I\'d like to read into a scalar variable exactly as it is in the file (preserving line separators and other whitespace).
The equivalent
If I don't have Slurp or Perl6::Slurp near by then I normally go with....
open my $fh, '<', 'file.txt' or die $!; my $whole_file = do { local $/; <$fh> };