Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #310 ("Arrays Intersection" and "Sort Odd Even")
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, cycling every Sunday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-02-24 through 2025-03-02 is #310. The tasks for challenge #310 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 310-1: Arrays Intersection Submitted by: Mohammad Sajid Anwar You are given a list of arrays of integers. Write a script to return the common elements in all the arrays. Example #1: Input: $list = ( [1, 2, 3, 4], [4, 5, 6, 1], [4, 2, 1, 3] ) Output: (1, 4) Example #2: Input: $list = ( [1, 0, 2, 3], [2, 4, 5] ) Output: (2) Example #3: Input: $list = ( [1, 2, 3], [4, 5], [6] ) Output: () I'll start by writing a subroutine that determines whether a given integer is in a given array of integers. Then I'll write a sub that determines whether a given integer is in all of the given arrays. Finally, I'll w...