Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };
http://www.perlmonks.org/index.pl?node_id=287647
open FILEHANDLE, 'somefile.txt' or die $!; my $string = do { local $/; };
The above idiom is a consise way to "slurp" the entire contents of a file into a scalar without using a loop, such as:
open FILEHANDLE, 'somefile.txt' or die $!; my $string = ''; while () { $string .= $_; }