http://www.perlmonks.org?node_id=50532


in reply to Re: Slurp a file
in thread Slurp a file

And my most-frequently-used variant of that is:
my $content = do {local $/; <SOMEHANDLE> };
Short, and effective.

-- Randal L. Schwartz, Perl hacker