Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #337 (“Count LE Others” and “Count Odds”)
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-09-01 through 2025-09-07 is #337 The tasks for challenge #337 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 337-1: Count LE Others Submitted by: Mohammad Sajid Anwar You are given an array of numbers, @num1. Write a script to return an array, @num2, where $num2[$i] is the count of all numbers in @num1 other than $num1[$i] which are less than or equal to $num1[$i]. Example #1: Input: @num1 = (6, 5, 4, 8) Output: (2, 1, 0, 3) Example #2: Input: @num1 = (7, 7, 7, 7) Output: (3, 3, 3, 3) Example #3: Input: @num1 = (5, 4, 3, 2, 1) Output: (4, 3, 2, 1, 0) Example #4: Input: @num1 = (-1, 0, 3, -2, 1) Output: (1, 2, 4, 0, 3) Example #5: Input: @num1 = (0, 1, 1, 2, 0) Output: (1, 3, 3, 4, 1) For each elemen...