Robbie Hatley’s Solutions, in Perl, for The Weekly Challenge #359 (“Digital Root” and “String Reduction”)
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 2026-02-02 through 2026-02-08 is #359. The tasks for challenge #359 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 359-1: Digital Root Submitted by: Mohammad Sajid Anwar You are given a positive integer, $int. Write a function that calculates the additive persistence of a positive integer and also return the digital root. Digital root is the recursive sum of all digits in a number until a single digit is obtained. Additive persistence is the number of times you need to sum the digits to reach a single digit. Example #1: Input: $int = 38 Expected output: Digital Root = 2; Persistence = 2 Example #2: Input: $int = 7 Expected output: Digital Root = 7; Persistence = 0 Example #3: Input: $int = 999 Expected output: Di...