From 53c8d6fe089609f98a513b5e55301f3fd9435112 Mon Sep 17 00:00:00 2001 From: Solathian Date: Mon, 29 May 2023 22:18:18 +0200 Subject: Added file for challenge --- challenge-219/solathian/perl/ch-1.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 challenge-219/solathian/perl/ch-1.pl 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 -- cgit