Perl Weekly Challenge 261: Element Digit Sum

These are some answers to the Week 261, Task 1, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a couple of days from now (on March 24, 2024 at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 1: Element Digit Sum

You are given an array of integers, @ints.

Write a script to evaluate the absolute difference between element and digit sum of the given array.

Example 1

Input: @ints = (1,2,3,45)
Output: 36

Element Sum: 1 + 2 + 3 + 45 = 51
Digit Sum: 1 + 2 + 3 + 4 + 5 = 15
Absolute Difference: | 51 - 15 | = 36

Example 2

Perl Weekly Challenge #221 - Good Strings, Bad Strings

Hi everybody! Very limited time this week so just a brief blog post.

This week we're looking for any words in the list that can be created only using letters from a dictionary string. Then print the number of characters in the good words.

Here's the code:

Perl Toolchain Summit 2023 in Lyon

Four years have passed since the last Perl Toolchain Summit (PTS) in Marlow. I planned to continue working on PAUSE's web UI, but I didn't exactly remember what to do. So the first thing I did at home before the PTS was to read through the PAUSE issues and do some triage. I also resumed a virtual machine that held PAUSE clones I had worked on. There I found an untracked docker-compose.yml. It was incomplete. I must have given it up because I already had a working environment. However, I remembered a few people wanted an easier way to install PAUSE. It would be helpful if they could run PAUSE on docker. Thus I started filling missing parts of the YAML file. After making a few serious mistakes, I made a draft pull request on the first day of the PTS. Matthew Horsfall took it over then.

This week in PSC (108) | 2023-05-26

After skipping last week, Rik and BooK met today and we:

  • happily confirmed there are no release blockers left
  • looked at HTTP::Tiny, which might really be one last blocker
  • reviewed the PPC list (see separate email)
  • think we’re ready for RC1!

Perl Weekly Challenge 258: Sum of Values

These are some answers to the Week 258, Task 2, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a couple of days from now (on March 3, 2024 at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 2: Sum of Values

You are given an array of integers, @int and an integer $k.

Write a script to find the sum of values whose index binary representation has exactly $k number of 1-bit set.

Example 1

Perl Weekly Challenge #218 - Feeling Negative

Hi everybody! Back this week with a solution to just the first challenge project. I know I won't have time for the second one, plus I'm not sure of an efficient solution. I really liked this first one, though! I got to try some new techniques in it.

Spoiler alert, since I know it's only Wednesday/Thursday depending on where you are, but if you're looking to solve this challenge yourself you might prefer not to read this yet.

So the goal of the first challenge is to find the 3 integers in a list that have the greatest product, and print the product.

First, here's the code as usual:

TWC 217: Big and Boundless in The Matrix

In which I must change a conference talk.

This week in PSC (107) | 2023-05-12

  • We went through the release blockers list again. One is now fixed (21044), one more should be closable once a perldelta PR is merged (20384), one more remains (21073)
  • We discussed the funding of some Perl events (like PTS) and how their sponsorship works now, and Philippe wondered whether TPRF could be helpful in managing some of the complexity of that. Rik said “very likely!” and suggested Philippe talk to them.

Perl Weekly Challenge 258: Count Even Digits Numbers

These are some answers to the Week 258, Task 1, 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 March 3, 2024 at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 1: Count Even Digits Number

You are given a array of positive integers, @ints.

Write a script to find out how many integers have even number of digits.

Example 1

Input: @ints = (10, 1, 111, 24, 1000)
Output: 3

There are 3 integers having even digits i.e. 10, 24 and 1000.

Example 2

Input: @ints = (111, 1, 11111)
Output: 0

Example 3

Response header name ' Content- type' contains invalid characters, after running a Perl_CGI script.

Hello ! Everyone, I am back here again to get your help.
Sorry, sorry for getting help alone and not helping other people's post.
But I will try to help others in another way, so please generous.
O.K. let me get started. I got weird error message as shown at the title, while I am reviewing the error_log at /var/log/httpd/ error_log. I never encountered this error message, so I can't figure the point of the error message. Does anyone has any clue to fix this error?

Cloud Provider Performance & Price Comparison 2023

CloudB.png

Last year I compared the various VM types of 7 popular cloud providers mainly for Perl performance, as I was looking at workloads that we'd be using at SpareRoom - you can see that comparison here.

This year I expanded the comparison to 10 providers, and while I posted it on dev.to, I thought I'd give a heads up to blogs.perl readers, especially to the commenters of the last years' post that had suggestions I incorporated.

TPRC Hackathon 2023

perl raku hackathon.png

The Perl and Raku Conference for 2023 will again feature a Hackathon Room. On July 10th, the Marketing Committee plans to coordinate activities for projects that have a broad impact on Perl.

We hope to involve 2-3 high impact projects and any number of smaller projects.

The committee will provide logistical and non-coding support for projects that want it. We want to help by:
  • matching people to projects and projects to people
  • keeping a record of commits and achievements for a post-event blog post
  • answer other questions like "where are bathrooms?" and "what is the wifi password?"
  • print and hang some pretty signs
  • manage the #hackathons2023 slack channel

Interested projects please comment on this post or contact us using marketing(at)perlfoundation(dot)org

Please note that anyone is welcome to use the room to hack on their project and to solicit help for it subject to the Conference SoC. This room is available on both the day before and the day after the conference. The wiki page for the Hackathon room is here

Perl Weekly Challenge 257: Reduced Row Echelon

These are some answers to the Week 257, Task 2, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Warning: I wrote the program below and this blog post from an hospital bed in a heart intensive care unit. I think my mind is clear, but there may very well be a better way to solve the task. Also, I do not have the energy to port this Raku program to other languages, nor to provide lengthy explanations.

Task 2: Reduced Row Echelon

Given a matrix M, check whether the matrix is in reduced row echelon form.

A matrix must have the following properties to be in reduced row echelon form:

Perl Weekly Challenge #216 - Choosing a Nickname for Your Car

Hi everybody!

Just one solution to the first task in the weekly challenge this week, and it's a different type. I didn't have time to do any more, and this solution might not be the most efficient or cleanest, but it looks reasonably good to me.

The goal is to find any words which contain all the letters of the car registration number. I assume this would be to find a nickname for your car based on its registration number. In the examples, all of the words are lower-case, so I just assume that my inputs are lower-case. This week I used a few language features that I haven't used in previous challenges, like loop labels, POSIX classes, and a variable regex. As usual, the first argument to the script (without the space in the rego in the examples) is the registration and the rest of the arguments are the words to match it to.

Here's the code: #!/usr/bin/perl

Welcome new contributors with the first-timers-only tag

I invite everyone involved in foss Perl projects to invest some time in being inclusive by creating and marking a few open issues/bugs with the label first-timers-only. The first-timers-only label explicitly announces:

I'm willing to hold your hand so you can make your first PR. This issue is a bit easier than normal. And anyone who's already contributed to open source isn't allowed to touch this one!

First timer contributions should very small and easy. But this makes it easier for the contributor to get the hang of the contribution process rather than the contribution itself. Remember, this isn't as much about getting your project features implemented quickly as it is about helping first timers have a welcoming experience.

How to Send and Receive Email with Perl

Perl is a versatile and powerful programming language that can be used for various tasks, including sending and receiving email. In this article, we will explore some of the modules and methods that can help you accomplish this goal.

Sending Email with Perl

There are different ways to send email with Perl. One way is to use the Email::MIME module to create and parse email messages, and the Email::Sender module to send them using various transports, such as SMTP or Sendmail. Another way is to use the Mail::Send module to create mail messages and send them using your local mail agent.

Example: Sending an Email with Email::MIME and Email::Sender

Here is an example of sending an email with Perl using Email::MIME and Email::Sender:

Perl Weekly Challenge 257: Smaller than Current

These are some answers to the Week 257, Task 1, 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 February 25, 2024 at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 1: Smaller than Current

You are given a array of integers, @ints.

Write a script to find out how many integers are smaller than current i.e. foreach ints[i], count ints[j] < ints[i] where i != j.

Example 1

Perl Weekly Challenge #219 - Squaring Up

Hi everybody! This week again because of time I only finished the first challenge of The Weekly Challenge. However, because work for my client requires Python, I'm busy learning Python and I thought "Why not do Python for a simple weekly challenge task?" This is the first Python code I've ever truly written and not just modified!

First, the Perl:

say $_ for (sort {$a <=> $b} (map {$_ * $_} @ARGV));

Yep, a one-liner. Normally I prefer to write longer, more readable code, but this time the task was so simple it made sense just to write it on one line.

We map each argument on the command line into its square, then sort (with a numerical sort because map defaults to strings) and then just say() them.

Originally I was sorting with a custom sort routine based on absolute values, but then I realized (thanks to other blog posts) that it would be more efficient not to abs() anything and just to replace everything with its square first, then sort.

PTS 2023

Asked to blog, my first reply would be "I do not blog". And I don't. Usually.

Reading the reports from the other participants of the PTS 2023 in Lyon, I however see the value to those that did not have the chance to participate.

Some history

Being the only participant that attended all previous events too, some history might be to the point.

This event started in 2008 when is was organized in Oslo with no agenda at all. The organizers (Salve) had the vague idea to get people from the perl world together in a meeting and discuss "things" that were related to "Quality" and "Testing". The organizers invited people that they thought to be of value and involved enough to get somewhere. Here are a few lines of that initial mail:

PTS 2023

I am writing this on my flight home from the PTS as I am terrible at writing things as they happen. :-)

The PTS proved to be a very valuable event, as it always has in the past. I am glad it is able to occur again in the wake of covid. One of the first things the group discussed was the lack of motivation in recent years when we could not meet, and how simply coming together again solved that problem for most of us.

This year my employer Grant Street Group paid for me to go to the PTS!

The first day largely became about important discussions for the toolchain group. Some included a majority of attendees, others were composed of smaller subsets depending on the topic.

Legacy Target Burden

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.