diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-10-14 02:59:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-14 02:59:14 +0100 |
| commit | 378fea5d4e7e7efd375bb32f1295140f7e83f6f7 (patch) | |
| tree | fefb98c902e601efcbfd99d274de34bbf39306c9 | |
| parent | 7310625286145d7f461042f5442cc3ca755c9159 (diff) | |
| parent | f9364ac6a1930278e9b56f7165ab3f3a9744990e (diff) | |
| download | perlweeklychallenge-club-378fea5d4e7e7efd375bb32f1295140f7e83f6f7.tar.gz perlweeklychallenge-club-378fea5d4e7e7efd375bb32f1295140f7e83f6f7.tar.bz2 perlweeklychallenge-club-378fea5d4e7e7efd375bb32f1295140f7e83f6f7.zip | |
Merge pull request #2515 from choroba/ech080c
Update 080/2 - defined not needed, add Colin's test
| -rwxr-xr-x | challenge-080/e-choroba/perl/ch-2.pl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/challenge-080/e-choroba/perl/ch-2.pl b/challenge-080/e-choroba/perl/ch-2.pl index 394bec7202..1334624275 100755 --- a/challenge-080/e-choroba/perl/ch-2.pl +++ b/challenge-080/e-choroba/perl/ch-2.pl @@ -35,7 +35,7 @@ sub count_candies { } } } - return @$n + sum(grep defined, @candies) + return @$n + sum(@candies) } use Test::More; @@ -50,6 +50,8 @@ is count_candies( [1, 9, 10, 10, 0, 8, 9, 6, 2, 8, 0, 1, 3, 3, 1, 10, 1, 3, 8, 8] ), 37; +is count_candies([qw[ 1 9 5 2 6 8 9 10 2 5 1 ]]), 25, 'Colin'; + done_testing(); __END__ |
