diff options
| author | Bob Lied <boblied+github@gmail.com> | 2023-09-18 10:09:33 -0500 |
|---|---|---|
| committer | Bob Lied <boblied+github@gmail.com> | 2023-09-18 10:09:33 -0500 |
| commit | d5c84ed05f7d37a00dbb6a9b48dd598511e9dc50 (patch) | |
| tree | 9b5fd3ee154ff662fd60658643ba213e4d7d9fad | |
| parent | abc5d51f65ffafb1be1919668984f50335915c6c (diff) | |
| download | perlweeklychallenge-club-d5c84ed05f7d37a00dbb6a9b48dd598511e9dc50.tar.gz perlweeklychallenge-club-d5c84ed05f7d37a00dbb6a9b48dd598511e9dc50.tar.bz2 perlweeklychallenge-club-d5c84ed05f7d37a00dbb6a9b48dd598511e9dc50.zip | |
Week 235 Task 1 solution
| -rw-r--r-- | challenge-235/bob-lied/perl/ch-1.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/challenge-235/bob-lied/perl/ch-1.pl b/challenge-235/bob-lied/perl/ch-1.pl index 10b33b72be..06ce8fe5cf 100644 --- a/challenge-235/bob-lied/perl/ch-1.pl +++ b/challenge-235/bob-lied/perl/ch-1.pl @@ -39,12 +39,13 @@ sub removeOne(@ints) return $rmvCount < 2; } -# Map each pair to true/false for being sorteed ascending. Count the falses. +# Map each pair to true/false for being sorted ascending. Count the falses. # Will be inefficient if the list is long and the out-of-order elements are # near the front. sub ro_A(@ints) { - my $rmvCount = grep { $_ == false } map { $ints[$_] < $ints[$_+1] } 0 .. ( $#ints-1 ); + my $rmvCount = grep { $_ == false } + map { $ints[$_] < $ints[$_+1] } 0 .. ( $#ints-1 ); return $rmvCount < 2; } |
