diff options
| -rw-r--r-- | challenge-060/mohammad-anwar/perl/ch-2a.pl | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/challenge-060/mohammad-anwar/perl/ch-2a.pl b/challenge-060/mohammad-anwar/perl/ch-2a.pl index 2d1eeb261e..fce05f4d4a 100644 --- a/challenge-060/mohammad-anwar/perl/ch-2a.pl +++ b/challenge-060/mohammad-anwar/perl/ch-2a.pl @@ -6,11 +6,7 @@ use warnings; use Test::More; use Algorithm::Combinatorics qw(variations_with_repetition); -my @n = (0, 1, 2, 5); -my $x = 2; -my $y = 21; - -my @numbers = find_numbers(\@n, $x, $y); +my @numbers = find_numbers([0, 1, 2, 5], 2, 21); is (join(", ", @numbers), "10, 11, 12, 15, 20"); done_testing; @@ -19,7 +15,7 @@ sub find_numbers { my ($n, $x, $y) = @_; my @numbers = (); - foreach my $number (variations_with_repetition(\@n, $x)) { + foreach my $number (variations_with_repetition($n, $x)) { $number = join("", @$number) + 0; next unless ((length($number) == $x) && ($number < $y)); push @numbers, $number; |
