aboutsummaryrefslogtreecommitdiff
path: root/challenge-252
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-252')
-rwxr-xr-xchallenge-252/perlboy1967/perl/ch1.pl3
1 files changed, 1 insertions, 2 deletions
diff --git a/challenge-252/perlboy1967/perl/ch1.pl b/challenge-252/perlboy1967/perl/ch1.pl
index 0e2f5ffd72..45f0b7d04e 100755
--- a/challenge-252/perlboy1967/perl/ch1.pl
+++ b/challenge-252/perlboy1967/perl/ch1.pl
@@ -29,8 +29,7 @@ use List::Util qw(sum0);
sub specialNumbers (@ints) {
my $n = $#ints + 1;
- sum0 map { my $i = $_ - 1;
- $n % $_ == 0 ? $ints[$i] ** 2 : 0 } 1 .. $n;
+ sum0 map { $n % $_ == 0 ? $ints[$_ - 1] ** 2 : 0 } 1 .. $n;
}
is(specialNumbers(1,2,3,4),21);