Skip to content

Latest commit

 

History

History
23 lines (13 loc) · 379 Bytes

Read_entire_file.md

File metadata and controls

23 lines (13 loc) · 379 Bytes
my $string = slurp 'sample.txt';

The default encoding is UTF-8. The :enc adverb can be used to specify a different one:

my $string = slurp 'sample.txt', :enc<UTF-16>;

IO::Path objects also provide slurp as a method:

my $string = 'sample.txt'.IO.slurp;