aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-213/cheok-yin-fung/perl/ch-1.pl17
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];