Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Read-entire-file/Perl/read-entire-file-1.pl
Normal file
2
Task/Read-entire-file/Perl/read-entire-file-1.pl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
use File::Slurper 'read_text';
|
||||
my $text = read_text($filename, $data);
|
||||
2
Task/Read-entire-file/Perl/read-entire-file-2.pl
Normal file
2
Task/Read-entire-file/Perl/read-entire-file-2.pl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
use Path::Tiny;
|
||||
my $text = path($filename)->slurp_utf8;
|
||||
2
Task/Read-entire-file/Perl/read-entire-file-3.pl
Normal file
2
Task/Read-entire-file/Perl/read-entire-file-3.pl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
use IO::All;
|
||||
$text = io($filename)->utf8->all;
|
||||
4
Task/Read-entire-file/Perl/read-entire-file-4.pl
Normal file
4
Task/Read-entire-file/Perl/read-entire-file-4.pl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
open my $fh, '<:encoding(UTF-8)', $filename or die "Could not open '$filename': $!";
|
||||
my $text;
|
||||
read $fh, $text, -s $filename;
|
||||
close $fh;
|
||||
7
Task/Read-entire-file/Perl/read-entire-file-5.pl
Normal file
7
Task/Read-entire-file/Perl/read-entire-file-5.pl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
my $text;
|
||||
{
|
||||
local $/ = undef;
|
||||
open my $fh, '<:encoding(UTF-8)', $filename or die "Could not open '$filename': $!";
|
||||
$text = <$fh>;
|
||||
close $fh;
|
||||
}
|
||||
1
Task/Read-entire-file/Perl/read-entire-file-6.pl
Normal file
1
Task/Read-entire-file/Perl/read-entire-file-6.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
my $text = do { local( @ARGV, $/ ) = ( $filename ); <> };
|
||||
1
Task/Read-entire-file/Perl/read-entire-file-7.pl
Normal file
1
Task/Read-entire-file/Perl/read-entire-file-7.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
perl -n -0777 -e 'print "file len: ".length' stuff.txt
|
||||
3
Task/Read-entire-file/Perl/read-entire-file-8.pl
Normal file
3
Task/Read-entire-file/Perl/read-entire-file-8.pl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
use File::Map 'map_file';
|
||||
map_file(my $str, "foo.txt");
|
||||
print $str;
|
||||
4
Task/Read-entire-file/Perl/read-entire-file-9.pl
Normal file
4
Task/Read-entire-file/Perl/read-entire-file-9.pl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
use Sys::Mmap;
|
||||
Sys::Mmap->new(my $str, 0, 'foo.txt')
|
||||
or die "Cannot Sys::Mmap->new: $!";
|
||||
print $str;
|
||||
Loading…
Add table
Add a link
Reference in a new issue