aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ferrone <zapwai@gmail.com>2023-05-15 09:18:43 -0400
committerDavid Ferrone <zapwai@gmail.com>2023-05-15 09:18:43 -0400
commit4dc03c113400b08faf5c0030bffc109b7bdbb2f2 (patch)
tree58f61f0c5a8c35bffd2ea2033eb35c4c5556a031
parent2c1bcc0ab979fa1d961919dc782cdcc322d7ed63 (diff)
downloadperlweeklychallenge-club-4dc03c113400b08faf5c0030bffc109b7bdbb2f2.tar.gz
perlweeklychallenge-club-4dc03c113400b08faf5c0030bffc109b7bdbb2f2.tar.bz2
perlweeklychallenge-club-4dc03c113400b08faf5c0030bffc109b7bdbb2f2.zip
Week 217
-rw-r--r--challenge-217/zapwai/perl/ch-1.pl15
-rw-r--r--challenge-217/zapwai/perl/ch-2.pl7
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-217/zapwai/perl/ch-1.pl b/challenge-217/zapwai/perl/ch-1.pl
new file mode 100644
index 0000000000..5e678963de
--- /dev/null
+++ b/challenge-217/zapwai/perl/ch-1.pl
@@ -0,0 +1,15 @@
+use v5.30.0;
+my @matrix = ([3, 1, 2], [5, 2, 4], [0, 1, 3]);
+
+print "Input: \@matrix = (";
+for (0 .. $#matrix) {
+ print '[' . join(",",@{$matrix[$_]}) . "]";
+ print ", " unless ($_ == $#matrix);
+}
+say ")";
+print "Output: ";
+my @list;
+push @list, @$_ foreach (@matrix);
+@list = sort @list;
+say $list[2];
+say "Sorted list: " . join(",", @list);
diff --git a/challenge-217/zapwai/perl/ch-2.pl b/challenge-217/zapwai/perl/ch-2.pl
new file mode 100644
index 0000000000..5f2206c249
--- /dev/null
+++ b/challenge-217/zapwai/perl/ch-2.pl
@@ -0,0 +1,7 @@
+use v5.30.0;
+my @list = (1, 23);
+#my @list = (5, 11, 4, 1, 2);
+say "Input: \@list = (" . join(",",@list) . ")";
+print "Output: ";
+@list = reverse sort @list;
+say @list;