From f9364ac6a1930278e9b56f7165ab3f3a9744990e Mon Sep 17 00:00:00 2001 From: "E. Choroba" Date: Wed, 14 Oct 2020 00:50:25 +0200 Subject: Update 080/2 - defined not needed, add Colin's test --- challenge-080/e-choroba/perl/ch-2.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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__ -- cgit