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