Monthly Report - July

Survived another month?

God, the year 2020 seems never ending. I just pray it gets over quickly and we start fresh with new year 2021. Unfortunately we have to wait for another 5 months. In the current situation, anything can happen in this period. Please stay safe and avoid unnecessary human contacts.

So what was the main attraction of last month?

Well, quite a few, to begin with, I submitted 12 Pull Requests which is much better than the month before i.e. 9 Pull Requests. I remember there was time when I used to submit at least 50 PR every month. I aim to do at least 1 PR every 2 days i.e. 15 PR every month. Unfortunately I have only managed to do that in January i.e. 22 Pull Requests. I did come close to the target in two months e.g. May (13 Pull Requests) and July (12 Pull Requests). I am going to keep trying hard. Wish me luck.

Perl Weekly Challenge 112: Canonical Path and Climb Stairs

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

Spoiler Alert: This weekly challenge deadline is due in a few days (May 16, 2021). 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: Canonical Path

You are given a string path, starting with a slash ‘/’.

Write a script to convert the given absolute path to the simplified canonical path.

In a Unix-style file system:

- A period ‘.’ refers to the current directory

- A double period ‘..’ refers to the directory up a level

- Multiple consecutive slashes (‘//’) are treated as a single slash ‘/’

The canonical path format:

- The path starts with a single slash ‘/’.

- Any two directories are separated by a single slash ‘/’.

- The path does not end with a trailing ‘/’.

- The path only contains the directories on the path from the root directory to the target file or directory

Example:

SanDiego.pm Meeting, Tuesday, July 14th, 2020

The SanDiego.pm Quarterly Meeting is tonight, 7 PM PDT.

Because of the pesky disease that's been spreading, we'll be gathering online. The agenda for tonight is: Normal conversation and seeing how everyone is doing; if there are any questions that need to be answered, we'll do that; followed by jumping into our presentations. We have at least three, though if anybody would like to step up and add another to the mix, please let me know.

Meeting ID: 896 3919 9931 Link to the meeting: https://us02web.zoom.us/j/89639199931

Perl Mongers, Unite!

TL;DR:
Promote your next Perl Mongers meeting on The Meetings Page at The pm.org Wiki.

Detail:
pm.org is great for resources, but there's no obvious way to promote your meeting. Not that there needed to be when the meetings were local events, but now, thanks to Covid-19, these meetings are taking place virtually. Why limit yourself to your local members? I am convinced that there are plenty of pockets of mongers that, if united and connected, would make the world realize that Perl Is Not Dead.

If you are a Perl Monger organizer, consider putting your meeting on the wiki page. Let's see just how many active orgs we have!

BLOG: The Weekly Challenge #069

https://perlweeklychallenge.org/blog/weekly-challenge-069

Perl Weekly Challenge 111: Search Matrix and Ordered Letters

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

Spoiler Alert: This weekly challenge deadline is due in a few days (May 9, 2021). 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: Search Matrix

You are given 5x5 matrix filled with integers such that each row is sorted from left to right and the first integer of each row is greater than the last integer of the previous row.

Write a script to find a given integer in the matrix using an efficient search algorithm.

Example:

A FIXIT-dive into an old CPAN module

Let’s have a thought experiment. Assume there is an Open Source-licensed Perl module published on CPAN that you care about, and that hasn’t had any updates in a very long time - what are your options?

In this blog post, I’ll take a dive into this problem, and use the Geo::Postcodes::NO module as an example. As of this writing, the module version is 0.31, and it’s most recent release was in September 2006.

Initial assumptions

Before we begin, let’s lay bare the most important assumptions I’m having. Your case may differ, but I think the following ones are pretty safe.

Chicago.pm Virtual Meeting: July 23

Chicago.pm will host a virtual Perl Mongers meeting July 23 at 6:30 pm (Chicago time).

Late Weekly challenge 67 #1 only

I wrote some library to make combination in 2013.
I was overwhelming when I found this challenge but I found that it is buggy !!!

I think that finding combination isn't necessarily written using recursive calling.
so this is my first "working" solution.

it is possible to use some list of words (ex) "a", "b", "c" ) instead of number.

Perl Weekly Challenge 110: Valid Phone Numbers and Transposed File

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

Spoiler Alert: This weekly challenge deadline is due in a couple of days (May 2, 2021). 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: Valid Phone Numbers

You are given a text file.

Write a script to display all valid phone numbers in the given text file.

Acceptable Phone Number Formats:

+nn  nnnnnnnnnn
(nn) nnnnnnnnnn
nnnn nnnnnnnnnn

Input File:

It was bound to happen.

While I don't actually work in Perl these days, and not by choice, I still keep an eye on the community. The language is chugging along nicely. Perl 6 is out, so at least that joke has died down, features are being added, some beneficiary, some not. All is well in perland.

Then the news dropped. Perl 7. I was very interested. More so when I realised that it was a rebranding of the latest Perl. First, let me say one thing right off the bat. It's a good call. I'm all for it. In fact, I'm so all for it that I called for it in a post from 2011. At the time I suggested using codenames like Apple and others do, or to rebrand Perl 5.14 (at the time) as Perl 14 like Java did.

Here's why I thought, and still do, that this "rebranding" is a Good Thing:

CY's Take on PWC#067

This is a part of Perl Weekly Challenge(PWC) and the followings are related to my solutions. If you want to challenge yourself on Perl, go to https://perlweeklychallenge.org, code the latest challenges, submit codes on-time (by GitHub or email)(before Monday GMT+0 00:00) if possible, before reading my blog post.


The discussion of Perl 7 in blogs.perl.org # was so hot last week made me too shy to write PWC experience (stop, it's just an excuse!).

Some discussions were quite technical for a beginner. Anyway as a beginning coder in Perl 5, I would add "use warnings" in my final coding stage from now on to prepare for the change.

PWC#67 Task #2: Letter Phone

YouTube: The Weekly Challenge - 067

Task #1: Number Combinations (Perl)

Task #2: Letter Phone (Perl)

Perl Weekly Challenge 109: Chowla Numbers and Four Square Puzzle

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

Spoiler Alert: This weekly challenge deadline is due in a few days (April 25, 2021). 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: Chowla Numbers

Write a script to generate first 20 Chowla Numbers, named after, Sarvadaman D. S. Chowla, a London born Indian American mathematician. It is defined as:

C(n) = sum of divisors of n except 1 and n

Output:

0, 0, 0, 2, 0, 5, 0, 6, 3, 7, 0, 15, 0, 9, 8, 14, 0, 20, 0, 21

Originally, the task requested us to generate the first 37 Chowla numbers and I wrote implementations in 12 different languages based on that requirement. This requirement has now been amended to the first 20 Chowla numbers. I’ll fix the program and output for some implementations, but will leave some as they were developed.

Chowla Numbers in Raku

Lucky Number Per7

I swear it was Perl 5 just a moment ago. I turned my back for all of 5 minutes ...

I don't need the new features, but I don't like boilerplate and I'm happy to accommodate those who seek progress. Harking back to lessons from the past, SysAdmins of a certain age may remember the venerable a2p program for converting awk scripts to perl and the horrendous (but working) code that it produced. We had one of those running in production less than 2 years ago until I finally decided to re-write it in Modern Perl. A bit like moving house, as a community we need to face the pain every so often and address the risks and ptifalls, not as reasons to keep to the status quo, but as a checklist of problems to be solved.

Perhaps the most Perlish thing to do would be to actually go and ask the Python community what they would do differently in migrating to python3. Learn from other people's mistakes.

Breathing life into the (Emacs) cperl-mode

If you are an Emacs user, you might know or even use cperl-mode. I am using it, more or less since my first days with Perl. Back then, newsgroups were a thing, and Ilya Zakharevich recommended it occasionally. In older times cperl-mode was shipped with Perl, today it is part of Emacs.
If you use cperl-mode, you might also have had a look at the code and noticed that it hasn't seen much love in the last decade or so.
Perl, on the other hand, evolves. Version 5.32, for example, brings a new infix operator, and some future version might bring Cor.
Wouldn't it be nice if cperl-mode understood these new keywords?
I'm on my way to get familiar with emacs-lisp, ERT, and other stuff to see what I can do.
Ideas, contributions, comments, bug requests and criticism is welcome - There's a GitHub repository to get started.

From the user perspective, Perl strings have no bugs and work well.

I feel that in the upcoming version of Perl, the core team fixes the Unicode bug as a reason to break backward compatibility Perl 5.

Unicode in Perl internally has some inconsistencies due to conflicts between latin-1 and UTF-8.

this is true.

On the other hand, from the user's point of view, a Perl string works perfectly fine if you only accept it can't tell whether it's a decoded string or a bytes.

We are solving this problem by convention.

Where do we determine if it is a string or a bytes?

The inside and outside of the program are completely separate.

If the data comes in from outside, then we will determine if it is a bytes or a string.

If it is a bytes, do nothing.

If it is a string, decode it.

This is simple and all of all works well.

In fact, this way is a good one.

Inside the program, we don't need to worry about the character code.

Perl Weekly Challenge 108: Locate Memory and Bell Numbers

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

Spoiler Alert: This weekly challenge deadline is due in a few days (April 18, 2021). 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: Locate Memory

Write a script to declare a variable or constant and print it’s location in the memory.

Locate Memory in Raku

BLOG: The Weekly Challenge #068

https://perlweeklychallenge.org/blog/weekly-challenge-068

Perl 7: A Risk-Benefit Analysis

At the recent Conference in the Cloud for Perl and Raku, Sawyer X (the pumpking of Perl) announced an ambitious plan for Perl 7. Since Perl 6 was renamed to Raku to better communicate its fundamental differences from the well known identity of Perl, major versions are now available again for Perl to leverage, and it is a very important step to show that the language is still developed and used. I completely agree with the motivation and ideals presented, and have thought a lot about the benefits and risks involved in such ideas long before I was aware of this project.

About blogs.perl.org

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