use warnings;
use strict;
use File::Slurp;
#
# Read file into string (scalar context).
#
my $file_text=read_file(__FILE__);
print $file_text;
#
# Read file into array (list context).
#
my @file_lines=read_file(__FILE__);
print join ". ", @file_lines;
#
# Write a file (write this script in uppercase letters)
#
write_file('file.out', map { uc } @file_lines);
use warnings; use strict; use File::Slurp; my $file_name = 'written_file.txt'; unlink $file_name if -f $file_name; my @lines = ( "foo bar baz\n", "one two three\n", "1 2 3 4 5 6 7 8 9\n" ); write_file($file_name, @lines);
File::Slurp. When googling around about that, I found a few writers that said that File::Slurper should be used instead of File::Slurp. System.IO.File::ReadAllText