Perl Weekly Challenge 82: Common Factors

These are some answers to the Week 82 of the Perl Weekly Challenge organized by Mohammad S. Anwar

Monthly Report - September

Time just flies.

Hacktoberfest event is back with a bang. I have to be honest, this time I am not as excited as I used to be.


Well, ever since I decided to go slow on submitting Pull Request, I find it hard to find anything simple and easy to work with. Another reason, I don't spend much time review latest upload on CPAN. Earlier, I would constantly watch every upload on CPAN and find anything needed helping hand.

Most of my spare time these days dedicated to "The Weekly Challenge", I rarely find time to review any CPAN module. Having said, I still manage to submit just few to keep the continuity. I struggle to even get 2-digits number each month. Last month, I could only submit 6 Pull Request, at least it is better than August.

Ubuntu + Perl Web Development Environment Building

I wrote here the steps to build a web system development environment using Perl and Ubuntu.

This is a very convenient procedure if you want to create a web application using Perl.

Ubuntu + Perl Web Development Envrinment Building

A meta issue for modules: bug tracking

I was reading a module on meta::cpan when I spied a small issue. I went up to the Issues link, clicked, and was sent to rt.cpan. I know that many module authors now have their modules on sites like GitHub, GitLab, or Bitbucket. Before I posted the issue on rt.cpan, I checked the author's profile for a linked account to one of the other sites. I found the module on GitHub and read the to find the author does want issues reported there and not rt.cpan. I did not report my original issue, I reported the link issue instead as it seemed more important.

Today is not the first time I noticed this issue with a module's bug tracking.

Before continuing, I have not released a module to CPAN and am still learning all that goes into releasing one. Please be gentle if I am wrong or stating an obvious well known fact.

Perl Weekly Challenge 81: Frequency Sort

These are some answers to the Week 81 of the Perl Weekly Challenge organized by Mohammad S. Anwar

Frequency Sort

You are given file named input.

Write a script to find the frequency of all the words.

It should print the result as the first column of each line should be the frequency of the the word followed by all the words of that frequency arranged in lexicographical order. Also sort the words in the ascending order of frequency.

Input file

Gisle Aas's CPAN distributions are available for adoption

Gisle Aas (GAAS on CPAN) is a well-known CPAN author, who made his first releases back in 1995. Over the years he has developed and maintained a number of keystone modules that most of us have relied on, whether we realised it or not. Gisle has informed the PAUSE admins that he will no longer be maintaining his CPAN distributions, and is open to responsible adoption. In this blog post we'll summarise what distributions are available, and our interpretation of responsible adoption.

If you're interested, please read this post, and if you still would like to adopt a distribution, contact the PAUSE admins (modules at perl dot org) and not Gisle.

while loops that have an index

Perl got this syntax that allow to use a while loop without having to explicitly increment an index by doing an i++. It is made possible by the each function.

Let's demonstrate this in a simple test that check that and array and an array ref contains the same things:

OO linked lists in Perl

After many days, trying to implement linked lists by nested hash (link to Rosetta Code) (link to my code) or Struct::Dumb, I get how to write the (singly) linked list in object-oriented style by Perl. One with bless, another one with Moose. Keep the learning record here.

Updated: See the link in comment section of Tobyink, a showcase of his OO module Zydeco. Thanks Toby!

#reference: “Object Oriented Perl” by Damian Conway 

use strict;
use warnings;

package SLL::Node;
use strict;

sub new {
    my $class = $_[0];
    my $objref = {
        _value => $_[1],
        _nextnode => $_[2],
    bless $objref, $class;
    return $objref;

sub new {
    my ($class) = @_;
    bless {
        _value => $_[1],
        _nextnode => $_[2],
    }, $class;

sub value { $_[0]->{_value} }

sub nextnode { $_[0]->{_nextnode} }


my $node_a = SLL::Node->new(30undef);
my $node_b = SLL::Node->new(40, \$node_a);
my $node_c = SLL::Node->new(70, \$node_b);

my $node_head = SLL::Node->new(undef, \$node_c);

my $node = $node_head;

do {
    $node = ${$node->nextnode};
    print $node->value ;
while ($node->nextnode);

print \n;

#print 70 40 30

Perl Weekly Challenge 80: Smallest Positive Number Bits and Count Candies

These are some answers to the Week 80 of the Perl Weekly Challenge organized by Mohammad S. Anwar

Spoiler Alert: This weekly challenge deadline is due in several days (October 4, 2020). 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: Smallest Positive Number Bits

You are given unsorted list of integers @N.

Write a script to find out the smallest positive number missing.

Example 1:

Input: @N = (5, 2, -2, 0)
Output: 1

Example 2:

Input: @N = (1, 8, -1)
Output: 2

Example 3:

Input: @N = (2, 0, -1)
Output: 1

Smallest Positive Integer Missing in Raku

Week #079: Count Set Bits & Trapped Rain Water

Please follow the blog where I discuss the "Count Set Bits" and "Trapped Rain Water" task of "The Weekly Challenge - 079".

I Write comment to Perl7 is a fork of values

I Write comment to Perl7 is a fork of values

I think the current Perl 7 plan is very heavy for the resources available to the Perl community.

Perl 7 will succeed if many people welcome it and everyone supports it.

However, I think the remaining users of Perl will remain because of the stability of that Perl.

If, in reality, the move to Perl 7 doesn't work, I think it's an opportunity to reconsider adopting "use v7".

I have a very similar thinking of Leon.

By the way.

Why doesn't my question get a reply when I post it to Per 5 Porters mailing list?

Crosspost: Nginx/Certbot Recipe

Back in Februrary I posted an article in which I promised a follow up telling you how I now manage my certificates. We’ll all these months later I’ve finally published it to (to push its reach beyond just Perl) .

Perl Weekly Challenge 79: Count Set Bits and Trapped Rain Water

These are some answers to the Week 79 of the Perl Weekly Challenge organized by Mohammad S. Anwar

Spoiler Alert: This weekly challenge deadline is due in a couple of days (September 27, 2020). 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: Count Set Bits

You are given a positive number $N.

Write a script to count the total number of set bits of the binary representations of all numbers from 1 to $N and return $total_count_set_bit % 1000000007.

Example 1:

Week #078: Leader Element & Left Rotation

Please follow the blog where I discuss the "Leader Element" and "Left Rotation" task of "The Weekly Challenge - 078".


Today I released Zydeco::Lite, a re-implementation of Zydeco but just using standard Perl syntax. So for example, class { ... } becomes class(sub { ...});.

This has the advantage of much faster compile time, similar run time speed, fewer dependencies, and compatibility with older versions of Perl before the keyword API was introduced. Of course, in some circumstances these aren't important concerns, so the nicer syntax of the full Zydeco will be preferred.

Zydeco and Zydeco::Lite are both based on MooX::Press which itself is based on Moo, Type::Tiny, and other modules. I've taken the synopsis example from the Zydeco documentation and rewritten it using the different layers of abstraction.

Mid September Software Releases 2020

Perl5-IDEA 2020.2.3 (Perl5 plugins for IntelliJ IDEA)

"Profiler support and bugfixes"

LemonLDAP-NG Apache::Session::Browseable v1.3.8

"This release contains fixes for CVE-2020-16093, which concerns LDAP server certificate verification when using LDAPS."

Pulled Pork 0.7.4

"This release includes numerous bug fixes for some issues that have been around for some time. PulledPork v0.7.4 has been tested with Snort 2.16.1 and Snort 3.0.1."


Releases on each maintained branch

CLOC (Count Lines of Code) 1.88

"Add missing Raku_or_Prolog() subroutine; new languages and file types LLVM IR, Logos, Meson, Mojo, Odin, Jinja Templates, WXML, WXSS; support MATLAB block comments; minor bug fixes."

SSL Tools (rolling)

Pull requests accepted

Perl Weekly Challenge 78: Leader Element and Left Rotation

These are some answers to the Week 78 of of the Perl Weekly Challenge organized by Mohammad S. Anwar

Spoiler Alert: This weekly challenge deadline is due in a few days (September 20, 2020). 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: Leader Element

You are given an array @A containing distinct integers.

Write a script to find all leader elements in the array @A. Print (0) if none found.

An element is leader if it is greater than all the elements to its right side.

Example 1:

Input: @A = (9, 10, 7, 5, 6, 1)
Output: (10, 7, 6, 1)

Example 2:

Input: @A = (3, 4, 5)
Output: (5)

Week #77: Fibonacci Sum and Lonely X

Please follow the blog where I discuss the "Fibonacci Sum" and "Lonely X" task of "The Weekly Challenge - 077".

Expand one into two - CY's Take on TWC#077

If you want to challenge yourself on programming, especially on Perl and/or Raku, go to, code the latest challenges, submit codes on-time (by GitHub or email).

I found that I gained unnecessary promotion due to being in a GMT+8.00 timezone - my blogpost appears on the top of for longer hours.


Task 1 Fibonacci Sum

Another dish for math geek!


Coding Process

I spent a whole day on the Perl script on Fib Sum task. I worked on it until night. Then I have a rest. In the morning next day, finally I gave up a subroutine for cases like "7, 5, 3" => "6, 5, 4, 3, 2, 1" or "11, 9" => "10, 9, 8, 7". The hard time made me recall what I learnt after Challenge #055 Task 2 Wave Array, using a hash to remove any duplicates occurred -- instead of crazy handling of exception cases again and again.

Task Explanation

Web Scraping with Zydeco

So I like to keep local copies of my blog posts as Atom entries, but noticed yesterday that I had a few gaps in my collection. The Atom feeds offered by only have the most recent articles though, so I decided to write a quick script to scrape the posts. Luckily, I managed to get a table containing the URLs for each post I needed, so I didn't need to bother with following links to find the pages; I just needed to grab the content from them.

I thought some people might find the code interesting especially for its use of lazy attributes. This is one of those "it only needs to be used once, so making the code maintainable isn't important" kinds of projects, do bear that in mind. I've cleaned up the whitespace and added comments for this blog post, but other than that, it's just a quickly hacked together script.

About is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.