aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-219/solathian/perl/ch-1.pl12
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-219/solathian/perl/ch-1.pl b/challenge-219/solathian/perl/ch-1.pl
new file mode 100644
index 0000000000..2be5a1e383
--- /dev/null
+++ b/challenge-219/solathian/perl/ch-1.pl
@@ -0,0 +1,12 @@
+#!usr/bin/perl
+use v5.36;
+
+# Challenge 219 - 1 - Sorted Squares
+
+sortedSquares(-2, -1, 0, 3, 4); # (0, 1, 4, 9, 16)
+sortedSquares( 5, -4, -1, 3, 6); # (1, 9, 16, 25, 36)
+
+sub sortedSquares(@array)
+{
+ say join ', ', sort map{$_ * $_ } @array
+} \ No newline at end of file