diff options
Diffstat (limited to 'challenge-252')
| -rwxr-xr-x | challenge-252/perlboy1967/perl/ch1.pl | 3 |
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); |
