diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2023-04-23 18:39:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-23 18:39:30 +0100 |
| commit | 83ba2e53c3a61a39ea1bdeef4c993945bcb43043 (patch) | |
| tree | b4355d55b8207f51b6ad14629ce4710b7bb0d0f6 | |
| parent | c208742134631a57e504fca79a75a06cff6215b4 (diff) | |
| parent | 8905596cdc73283f589ef2d5c777d85246b90472 (diff) | |
| download | perlweeklychallenge-club-83ba2e53c3a61a39ea1bdeef4c993945bcb43043.tar.gz perlweeklychallenge-club-83ba2e53c3a61a39ea1bdeef4c993945bcb43043.tar.bz2 perlweeklychallenge-club-83ba2e53c3a61a39ea1bdeef4c993945bcb43043.zip | |
Merge pull request #7952 from E7-87-83/newt
Week 213 Task 1
| -rw-r--r-- | challenge-213/cheok-yin-fung/perl/ch-1.pl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-213/cheok-yin-fung/perl/ch-1.pl b/challenge-213/cheok-yin-fung/perl/ch-1.pl new file mode 100644 index 0000000000..5ceb058327 --- /dev/null +++ b/challenge-213/cheok-yin-fung/perl/ch-1.pl @@ -0,0 +1,17 @@ +# The Weekly Challenge 213 +# Task 1 Fun Sort +use v5.30.0; +use warnings; + +sub fs { + my @list = @_; + my @elist = grep {!($_ % 2)} @list; + my @olist = grep {$_ % 2} @list; + return ((sort {$a<=>$b} @elist) , (sort {$a<=>$b} @olist)); +} + +use Test::More tests=>3; +use Test::Deep; +cmp_deeply [fs(1,2,3,4,5,6)], [2,4,6,1,3,5]; +cmp_deeply [fs(1,2)], [2,1]; +cmp_deeply [fs(1)], [1]; |
