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 #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:

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 256: Merge Strings

These are some answers to the Week 256, Task 2, 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 18, 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: Merge Strings

You are given two strings, $str1 and $str2.

Write a script to merge the given strings by adding in alternative order starting with the first string. If a string is longer than the other then append the remaining at the end.

Example 1

Input: $str1 = "abcd", $str2 = "1234"
Output: "a1b2c3d4"

Example 2

Input: $str1 = "abc", $str2 = "12345"
Output: "a1b2c345"

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 256: Maximum Pairs

These are some answers to the Week 256, 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 18, 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: Maximum Pairs

You are given an array of distinct words, @words.

Write a script to find the maximum pairs in the given array. The words $words[i] and $words[j] can be a pair one is reverse of the other.

Example 1

Input: @words = ("ab", "de", "ed", "bc")
Output: 1

There is one pair in the given array: "de" and "ed"

Example 2

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 255: Most Frequent Word

These are some answers to the Week 255, Task 2, 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 11, 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: Most Frequent Word

You are given a paragraph $p and a banned word $w.

Write a script to return the most frequent word that is not banned.

Example 1

Input: $p = "Joe hit a ball, the hit ball flew far after it was hit."
       $w = "hit"
Output: "ball"

The banned word "hit" occurs 3 times.
The other word "ball" occurs 2 times.

Example 2

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

Require in Perl, what should I pay attention?

Hi ! Everyone there ! How are you ?
I am a Perl script programmer for business Server at /cgi-bin/. Recently I moved my Server from Perl 5.8.8. (Fedora Code 7) to Perl 5.32.1 (Rocky9.1).

After the movement a pair of Perl scripts (script_main.pl and script_sub.pl), in which I integrated the minor script_sub.pl into the main part (script_main.pl) by using "require".

In the main script_main.pl, I just inserted the following line,

require 'script_sub.pl';

By this way, two scripts worked as if one. While Perl version was 5.8.8. (Redhat Fedora Core 7) this way worked.

However, it appeared that when in Perl 5.32.1 (Rocky9.1) it encountered an error. I studied a little bit of Perl 5.32.1. There are "require", "use", and "import" as possible vocabulary. In my case, it is just joining two pieces of Perl code by the way of "require". What do you suggest in order to chop down into two pieces from a long full Perl script code CGI, and then to join them together ?

Thanks for your help !

Perl Weekly Challenge 255: Odd Character

These are some answers to the Week 255, 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 11, 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: Odd Character

You are given two strings, $s and $t. The string $t is generated using the shuffled characters of the string $s with an additional character.

Write a script to find the additional character in the string $t.

Example 1

Input: $s = "Perl" $t = "Preel"
Output: "e"

Example 2

Input: $s = "Weekly" $t = "Weeakly"
Output: "a"

Example 3

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:

Perl Toolchain Synergy

2023 has been a very Perl-centric year for me so far!

These days I spend a lot of time in Toronto. Back in January when I heard that the TPRC conference would be held there I joined the planning group post-haste. They still needed a venue and I helped them find the perfect one. We'll be right in the middle of the best part of that great city. I encourage you all to come. This one's gonna be great!

Around the same time, TINITA told me that the Perl Toolchain Summit was happening again in Lyon again (first since 2019). I really needed to reunion with my Perl family, so I bugged BOOK until he said "Come on over".

This week in PSC (106) | 2023-05-05

Porters,

After a meeting around an actual physical table at the Perl Toolchain Summit last week, the three of us were back to our regular video calls. The call was longer than usual, as we delved into the code of CPAN.pm.

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.