diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-11-16 19:42:50 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-16 19:42:50 +0000 |
| commit | 96467e77d0717b5e5fa367883354d383d4d679fb (patch) | |
| tree | ec924d6420fca7d123f8a9b3d23fb25c5acb220c | |
| parent | 1262c959c24fcd6a48ca0b3c115c9d2e4f561305 (diff) | |
| parent | 73de10891e10ae3444d1a10e971baef9eba947bd (diff) | |
| download | perlweeklychallenge-club-96467e77d0717b5e5fa367883354d383d4d679fb.tar.gz perlweeklychallenge-club-96467e77d0717b5e5fa367883354d383d4d679fb.tar.bz2 perlweeklychallenge-club-96467e77d0717b5e5fa367883354d383d4d679fb.zip | |
Merge pull request #5231 from PerlBoy1967/branch-for-challenge-139
Task 1
| -rwxr-xr-x | challenge-139/perlboy1967/ch-1.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/challenge-139/perlboy1967/ch-1.pl b/challenge-139/perlboy1967/ch-1.pl new file mode 100755 index 0000000000..6d613fe027 --- /dev/null +++ b/challenge-139/perlboy1967/ch-1.pl @@ -0,0 +1,31 @@ +#!/bin/perl + +=pod + +The Weekly Challenge - 139 + - https://perlweeklychallenge.org/blog/perl-weekly-challenge-139/#TASK1 + +Author: Niels 'PerlBoy' van Dijke + +TASK #1 › JortSort +Submitted by: Mohammad S Anwar + +You are given a list of numbers. + +Write a script to implement JortSort. It should return true/false depending +if the given list of numbers are already sorted. + +=cut + +use v5.16; +use strict; +use warnings; + +use List::MoreUtils qw(none slide); + +sub jortSort(@) { + no warnings 'once'; + none{$_<0}(slide{$b-$a}@_); +} + +printf "(%s) => %d\n", join(',',@ARGV), jortSort(@ARGV) // 'undef'; |
