use Perl6::Slurp;
my $data = slurp 'path/to/file';
OR
use File::Slurp;
my $text = read_file( 'filename' );
my $lines = read_file( 'filename', array_ref => 1 );
my $lines = read_file( 'filename', array_ref => 1, chomp => 1 );
OR
use File::Slurper;
OR
my $body = do { local( @ARGV, $/ ) = $filename; <> };
OR (if the file is under __DATA__)
my $body = join( '', <DATA> );
No comments:
Post a Comment