diff options
| author | Niels van Dijke <perlboy@cpan.org> | 2021-06-17 20:02:45 +0000 |
|---|---|---|
| committer | Niels van Dijke <perlboy@cpan.org> | 2021-06-17 20:02:45 +0000 |
| commit | 334b8f46cfbe5f0f6687c443cc8ce86ca0cc0c30 (patch) | |
| tree | 8d2f64b14638e54a53a11ca144aafba1465fe8b0 | |
| parent | 0f3f1e13ceb7a3942cfcc6174faf9d582e90b830 (diff) | |
| download | perlweeklychallenge-club-334b8f46cfbe5f0f6687c443cc8ce86ca0cc0c30.tar.gz perlweeklychallenge-club-334b8f46cfbe5f0f6687c443cc8ce86ca0cc0c30.tar.bz2 perlweeklychallenge-club-334b8f46cfbe5f0f6687c443cc8ce86ca0cc0c30.zip | |
Ditch File::Slurp. No need for this time.
| -rwxr-xr-x | challenge-117/perlboy1967/perl/ch-1.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/challenge-117/perlboy1967/perl/ch-1.pl b/challenge-117/perlboy1967/perl/ch-1.pl index 1a22567af0..109b8e42e7 100755 --- a/challenge-117/perlboy1967/perl/ch-1.pl +++ b/challenge-117/perlboy1967/perl/ch-1.pl @@ -12,7 +12,6 @@ use strict; use warnings; use File::Basename qw(dirname); -use File::Slurp qw(read_file); use List::MoreUtils qw(slide); my $input = $ARGV[0] // sprintf('%s/input.txt',dirname($0)); @@ -23,6 +22,8 @@ printf "Missing row number(s) of file '%s' is/are '%s'\n", sub missingRows { my ($f) = @_; + + open(my $fh,'<',$f) || die; - return grep /\d/,slide{($a+1..$b-1)if($b-$a>1)}sort{$a<=>$b}map{/^(\d+)/;$_=$1}read_file($f); + return grep /\d/,slide{($a+1..$b-1)if($b-$a>1)}sort{$a<=>$b}map{/^(\d+)/;$_=$1}<$fh>; } |
