Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #331 (“Last Word” and “Buddy Strings”)
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-07-21 through 2025-07-27 is #331 The tasks for challenge #331 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 331-1: Last Word Submitted by: Mohammad Sajid Anwar You are given a string. Write a script to find the length of last word in the given string. Example #1: Input: $str = "The Weekly Challenge" Output: 9 Example #2: Input: $str = " Hello World " Output: 5 Example #3: Input: $str = "Let's begin the fun" Output: 3 There are a number of ways of approaching this, including using "split" to obtain a list of words which are in the string. But I'll use a simpler approach: I'll use an m// operator with a (capture group) to isolate the final word...