Here are solutions to this weeks challenges from the Perl Weekly Challenge.
You can find my full code on
Github
Task 1: Pack a Spiral
You are given an array @A of items (integers say, but they can be anything).
Your task is to pack that array into an MxN matrix spirally counterclockwise, as tightly as possible.
‘Tightly’ means the absolute value |M-N| of the difference has to be as small as possible./users/james_curtis-smith/2021/02/index.html
We are finally here - we have hit week 100 of Manwar's Perl Weekly Challenges, and here are solutions to this weeks challenges from the Perl Weekly Challenge.
You can find my full code on
Github
Task 1: Fun time
You are given a time (12 hour / 24 hour). Write a script to convert the given time from 12 hour format to 24 hour format and vice versa. Ideally we expect a one-liner.
Example 1: Input: 05:15 pm or 05:15…
Here are solutions to this weeks challenges from the Perl Weekly Challenge.
You can find my full code on
Github
Challenge 1
You are given a string $S and a pattern $P.
Write a script to check if given pattern validate the entire string. Print 1 if pass otherwise 0.
The patterns can also have the following characters:
- ? - Match any single character.
- * - Match any sequence of characters.…
Here are solutions to this weeks challenges from the Perl Weekly Challenge.
You can find my full code on
Github
Challenge 1
You are given file $FILE.
Create subroutine readN($FILE, $number) returns the first n-characters and moves the pointer to the (n+1)th character.
Solution
Rather than turning this into an object which was the first idea - I decided t…