use IO::All;
$content = io('file.txt')->slurp;
# or
io('file.txt') > $content;
# or
use File::Slurp;
$content = read_file( 'filename' );
# or any number of include methods in Mason/Template/Embperl...
The things that IO::All makes absurdly easy include (and aren't limited to):
- Tied files.
- Appending to file.
- Appending to our original string with a new file: $content << io('new.txt');
- Inserting the contents of a web page, even a secure one, into a string.
- Running a flat DB.
- Reading files backwards.
- Doing socket communication; clients and servers.
- File stats and File::Spec support.
- and so on; most can be done in one line.