From 334b8f46cfbe5f0f6687c443cc8ce86ca0cc0c30 Mon Sep 17 00:00:00 2001 From: Niels van Dijke Date: Thu, 17 Jun 2021 20:02:45 +0000 Subject: Ditch File::Slurp. No need for this time. --- challenge-117/perlboy1967/perl/ch-1.pl | 5 +++-- 1 file 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>; } -- cgit