diff options
| author | Paulo Custodio <pauloscustodio@gmail.com> | 2021-10-28 18:03:55 +0100 |
|---|---|---|
| committer | Paulo Custodio <pauloscustodio@gmail.com> | 2021-10-28 18:03:55 +0100 |
| commit | d08524c217257b3cc4c9c19b24ecf8720f63d8dd (patch) | |
| tree | c5ca7fabd90a6ab134cf8dff392362525c81e593 /challenge-003 | |
| parent | 7398636a001a651201da43feefcdf55340aa91bd (diff) | |
| download | perlweeklychallenge-club-d08524c217257b3cc4c9c19b24ecf8720f63d8dd.tar.gz perlweeklychallenge-club-d08524c217257b3cc4c9c19b24ecf8720f63d8dd.tar.bz2 perlweeklychallenge-club-d08524c217257b3cc4c9c19b24ecf8720f63d8dd.zip | |
Add solutions to challenges 123, 124
Diffstat (limited to 'challenge-003')
| -rw-r--r-- | challenge-003/paulo-custodio/Makefile | 2 | ||||
| -rw-r--r-- | challenge-003/paulo-custodio/perl/ch-1.pl | 13 | ||||
| -rw-r--r-- | challenge-003/paulo-custodio/perl/ch-2.pl | 4 | ||||
| -rw-r--r-- | challenge-003/paulo-custodio/test.pl | 4 |
4 files changed, 5 insertions, 18 deletions
diff --git a/challenge-003/paulo-custodio/Makefile b/challenge-003/paulo-custodio/Makefile new file mode 100644 index 0000000000..6316089eb8 --- /dev/null +++ b/challenge-003/paulo-custodio/Makefile @@ -0,0 +1,2 @@ +all: + perl ../../challenge-001/paulo-custodio/test.pl diff --git a/challenge-003/paulo-custodio/perl/ch-1.pl b/challenge-003/paulo-custodio/perl/ch-1.pl index e1c2d5b0f8..afd712b149 100644 --- a/challenge-003/paulo-custodio/perl/ch-1.pl +++ b/challenge-003/paulo-custodio/perl/ch-1.pl @@ -7,17 +7,8 @@ # or equal to 5. They are also called Hamming/Regular/Ugly numbers. For more # information, please check this wikipedia. -use strict; -use warnings; -use 5.030; - -sub min { - my($min, @a) = @_; - for (@a) { - $min = $_ if $min > $_; - } - return $min; -} +use Modern::Perl; +use List::Util 'min'; # return an iterator to generate the sequence # the sequence is a merge of all multiples of 2, 3 and 5 diff --git a/challenge-003/paulo-custodio/perl/ch-2.pl b/challenge-003/paulo-custodio/perl/ch-2.pl index bb3afc06e2..83ab59311f 100644 --- a/challenge-003/paulo-custodio/perl/ch-2.pl +++ b/challenge-003/paulo-custodio/perl/ch-2.pl @@ -7,9 +7,7 @@ # the command line. The Pascal Triangle should have at least 3 rows. For more # information about Pascal Triangle, check this wikipedia page. -use strict; -use warnings; -use 5.030; +use Modern::Perl; my($rows) = @ARGV; diff --git a/challenge-003/paulo-custodio/test.pl b/challenge-003/paulo-custodio/test.pl deleted file mode 100644 index ba6c37260b..0000000000 --- a/challenge-003/paulo-custodio/test.pl +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env perl -use Modern::Perl; -use Test::More; -require '../../challenge-001/paulo-custodio/test.pl'; |
