These are some answers to the Week 143 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on December 19, 2021 at 24:00). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Task 1: Calculator
You are given a string, $s, containing mathematical expression.
Write a script to print the result of the mathematical expression. To keep it simple, please only accept + - * ().
Example 1:
Input: $s = "10 + 20 - 5"
Output: 25
Example 2:
Input: $s = "(10 + 20 - 5) * 2"
Output: 50
Calculator in Raku
(Originally published on samirparikh.com.)
Like any well-entrenched programming language, Perl has a rich history and a number of personalities who shape and lead its community. In addition to wanting to learn its syntax and how to write simple scripts with it, I'm also trying to learn more about that history and the people who influence it today. I do this by following some blogs (which perhaps I'll write about later) and reading online books and articles but the best way for me is to listen to relevant podcasts. I'm an avid podcast listener and love learning about new concepts or technologies while walking the dog, doing the dishes, or pre-pandemic, sitting in traffic. Over the past few weeks, I've been listening to some contemporary as well as not so recent Perl-related podcasts and thought I'd share some select episodes that others may find interesting:
For letting me know my test coverage has increased by 0.00006%.

(Seriously it's a pretty cool service though.)
Dave Cross already suggested to use other forums for Perl-related posts, especially pointing to dev.to where our posts can be more visible to the outside world than here on bpo.
I followed his advice and started to post there too. I even volunteered to become a moderator of the #perl tag on dev.to.
So I'd like to invite you to follow that tag and to post articles there using the #perl tag and other tags that might be relevant to your posts.
These are some answers to the Week 142 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on December 12, 2021 at 24:00). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Task 1: Divisor Last Digit
You are given positive integers, $m and $n.
Write a script to find total count of divisors of $m having last digit $n.
Example 1:
Input: $m = 24, $n = 2
Output: 2
The divisors of 24 are 1, 2, 3, 4, 6, 8 and 12.
There are only 2 divisors having last digit 2 are 2 and 12.
Example 2:
Ed J has taken over maintenance of my suite of GraphViz2 modules.
The first change has been to split it into multiple distros, so that
anyone using just GraphViz2 will have a much smaller download and only
6 pre-reqs.
Another change is to rework the decision, which I copied from the
original www.graphviz.org, and which meant nodes and port names were
joined with a colon. For e.g. MS Windows users wanting to represent disk
names like C:, this is clearly problematic.
There is a new option combine_node_and_port, which defaults to true but
in May 2021 or so will switch to defaulting to false. When true, the
current problematic behaviour occurs. When false, more DWIM-ish
behaviour happens:
(Originally published on samirparikh.com.)
The latest installment of the Perl Weekly Challenge just dropped so I thought I would take a crack at it. Please note that the challenge is still currently open (as of date of publishing) in case you are participating.
Task #1
Task #1 asks the following:
You are given an array of real numbers greater than zero.
Write a script to find if there exists a triplet (a,b,c) such that 1 < a+b+c < 2. Print 1 if you succeed otherwise 0.
Example 1:
Input: @R = (1.2, 0.4, 0.1, 2.5)
Output: 1 as 1 < 1.2 + 0.4 + 0.1 < 2
Example 2:
Input: @R = (0.2, 1.5, 0.9, 1.1)
Output: 0
Example 3:
Input: @R = (0.5, 1.1, 0.3, 0.7)
Output: 1 as 1 < 0.5 + 1.1 + 0.3 < 2

Men Don't Cry.
I must confess I do cry and cry like a baby. It feels nice afterwards, I must say.
Last month was really difficult for me, on personal and professional front. On personal level, I am undergoing therapy for Depression and Anxiety.
On professional front, I missed many things. For the first time, I couldn't take part in Hacktoberfest in the same passion as before.
Another low point, I stopped contributing in Swift for The Weekly Challenge.
Then I stopped taking part in the weekly challenge completely. No weekly blog either talking about my contributions.
I didn't stop there, I even stopped doing live session video.
At one point, I even decided not to do monthly report.
With all the negativity, I received plenty of support and helping hands. Thanks everyone.
Let's take a quick look through last month main activities.
Pull Request
These are some answers to the Week 141 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on December 5, 2021 at 24:00). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Task 1: Number Divisors
Write a script to find lowest 10 positive integers having exactly 8 divisors.
Example:
24 is the first such number having exactly 8 divisors.
1, 2, 3, 4, 6, 8, 12 and 24.
This is quite straight forward. We can look at consecutive integers, count their factors, and stop when we reach ten integers having 8 divisors.
Number Divisors in Raku
I don't usually take part in the Perl Weekly Challenge but one of this week's challenges caught my eye. I thought it could be a fun thing to attempt and decided to use Zydeco to help solve it.
The problem is that you're given a matrix of 0s and 1s:

You need to find any squares (equal length sides) where all four corners are 1s:

(Originally published on samirparikh.com. Apologies in advance for going into some of the minute details of my thought process but I thought this might help others who are learning the language like I am.)
As I mentioned in yesterday's post, I've been trying to learn the Perl programming language. You can read all the books and tutorials you want, but for me, the only way to really learn a language is to apply it to real world problems. Unfortunately for me, I currently don't have any real world problems (suitable to be solved by Perl) so I've been practicing by solving coding puzzles on the internet. In addition to making my way through the bioinformatics site Rosalind, I've also started working on the Perl Weekly Challenges. This week, I managed to muddle my way through the latest installment, Challenge 084. The deadline to submit solutions is fast approaching so if you haven't solved it yourself yet, you may want to come back to this post later.
Task 1
Well, well, today I released Amusewiki 2.500 and I noticed that time
has passed since the last announcement here. This doesn't mean that
the Amusewiki development has stopped. On the contrary. The
development pace has been steady, with new features, improvements and
bug-fixes. In the meanwhile Amusewiki got a new logo as well!
The most notable changes are:
Installation size has been cut down to the minimum with a TeXlive!
repackaging (which can be installed on the fly by the installation
script or via the unofficial Debian packages).
Support for attached files has been extended. You can now upload
and display audio and video files.
Custom category types: you are no longer limited to authors and
topics, you can have custom categories.
As usual, documentation for old and new features can be found at
amusewiki.org, unofficial Debian package are
at packages.amusewiki.org and
sources are at
https://github.com/melmothx/amusewiki.
Detailed changelogs can be found here:
https://amusewiki.org/category/topic/releases.
It's worth noting that the Emacs Muse markup is supported by Pandoc
(as a reader and a writer) since version 2.0, and if you use the Atom
editor, there is a package for it.
Enjoy!
These are some answers to the Week 140 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Task 1: Add Binary
This task was covered in the following blog post: https://blogs.perl.org/users/laurent_r/2021/11/perl-weekly-challenge-140-add-binary.html.
Task 2: Multiplication Table
You are given 3 positive integers, $i, $j and $k.
Write a script to print the $kth element in the sorted multiplication table of $i and $j.
Example 1:
If you want to challenge yourself on programming, especially on Perl and/or Raku, go to https://perlweeklychallenge.org, code the latest challenges, submit codes on-time (by GitHub or email).
... before coding
Long time no blogging for The Weekly Challenge!
I found that I use "and/or" quite frequently in writing. I know, (mathematical-)logically we only need "or". It seems to me to be a language tricky part as the use of gender neutral terms.
I made a logical error for the "Lonely X" task in challenge 077.
$segment =~ s/XI/II/g;
$segment =~ s/IX/II/g;
$segment =~ s/XX/II/g;
should be
$segment =~ s/XX/II/g;
$segment =~ s/XI/II/g;
$segment =~ s/IX/II/g;
Task 1 Words Length
I immediately checked out the "Llama book" and checked the usage of
match variables in regular expressions. The result is a 3-line solution!
Yo:
$_ = <STDIN>;
/(^\w+\s)((\w+\s*)+)(\s\w+$)/;
print length $2,"\n";
Oooooooooooops, it works for 3-word string.
The answer comes down to two words: Security and Reliability.
As a bonus, less work on your part.
It's surprising to find that there are modules on CPAN that aren't using
ppport.h that could stand to benefit from it.
ppport.h is a file that is part of the Devel::PPPort distribution. As you
know, Perl has evolved over the years, adding new features, and new API for XS
writers to use. Some of that is to support the new features, and some to make
tasks easier to accomplish. ppport.h implements portions of the API that
people have found desirable to have when a module gets installed in a Perl that
was released before that API element was created. You can write your module
using the latest API, and have it automatically work on old Perls, simply by
#including ppport.h in your XS code. ppport.h generally provides support for
an API element as is reasonably practicable, with many supported to 5.03007.
From 2015, but it came across my screen this morning. Seems like it is still relevant.
System setup for modern perl projects
These are some answers to the Week 140 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on November 28, 2021 at 24:00). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Task 1: Add Binary
You are given two decimal-coded binary numbers, $a and $b.
Write a script to simulate the addition of the given binary numbers.
The script should simulate something like $a + $b. (operator overloading)
Example 1:
Input: $a = 11; $b = 1;
Output: 100
Example 2:
Input: $a = 101; $b = 1;
Output: 110
Example 3:
(Originally published on samirparikh.com.)
Just over one year ago, I wrote about how I had become enchanted with the D programming language as part of my journey in exploring new programming languages. I still really like D for all of the reasons I wrote about, but as I alluded to in the conclusion of that piece, I fully expected to “get distracted by the next new shiny thing that comes along.” Turns out that the next new shiny thing happens to be … Perl!
That’s right: a language that Larry Wall first developed back in 1987 happens to have caught my fancy and I’m as surprised as anyone.
I am writing this blog post to hand over all my programming books, (mostly perl) to any person that would like to use them.
This includes about a dozen O'rielly perl books (including the camel book) as well as other classics like:
The C programing language by K+R
TCP/IP by Comer
Design Patterns by GHJV
all free, but must take the whole box.
Contact me at freddo411 (at) gmail.
I am located in the Seattle area.
This blog post describes a common task my colleagues ask often about repeating a dynamic string in a defined token and adding some or, and, = in between, plus finishing smartly.
I like to use the Perl's __DATA__ token at the end of my scripts for this. The __DATA__ token strength is to make possible to « "embed” a file inside a Perl program then read it from the DATA filehandle ». It saves you the creation and opening of a real file and is very handy for quick prototypes and tests.