diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2023-05-30 10:24:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-30 10:24:06 +0100 |
| commit | 29474c26da3ee7bef8aa98b6aa65e34e3623f16a (patch) | |
| tree | 751ff1035ce038eda0fb034a14c356606eea4506 | |
| parent | 03da2e8e72831fd2a914b7c514310b1c66d462d4 (diff) | |
| parent | 53c8d6fe089609f98a513b5e55301f3fd9435112 (diff) | |
| download | perlweeklychallenge-club-29474c26da3ee7bef8aa98b6aa65e34e3623f16a.tar.gz perlweeklychallenge-club-29474c26da3ee7bef8aa98b6aa65e34e3623f16a.tar.bz2 perlweeklychallenge-club-29474c26da3ee7bef8aa98b6aa65e34e3623f16a.zip | |
Merge pull request #8161 from Solathian/branch-for-challenge-219
Added file for challenge
| -rw-r--r-- | challenge-219/solathian/perl/ch-1.pl | 12 |
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 |
