Robbie Hatley’s Solutions, in Perl, for The Weekly Challenge #390 (“Decode String” and “Order Characters”)
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-09-14 through 2026-09-20 is #390. The tasks for challenge #390 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 390-1: Decode String Submitted by: Mohammad Sajid Anwar You are given an encoded string. Write a script to return the decoded string of the given encoded string. The encoding rule is: K[encoded_string], where the encoded_string inside the square brackets is repeated exactly K > 0 times. I'll use a Perl s/// operator in a while loop to decode innermost bracket pairs for as long as some exist, thus solving the problem from the inside out. Robbie Hatley's Perl Solution to The Weekly Challenge 390-1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 39...