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.
Hi everybody, just a quick one this week. Again it's been a very busy week, so I wrote this one quick to print the sorted list of all common characters in all the words provided. That's the simple explanation of this week's challenge.
Here's the code:
my @results;
my $first_word = shift;
for my $letter (split(//, $first_word)) {
push(@results, lc($letter)) if (grep {$_ =~ /$letter/i} @ARGV) == @ARGV;
}
@results = sort @results;
say $_ foreach @results;
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.
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.
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?
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.
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?"
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
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:
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.
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.
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:
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.
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:
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.
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.
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 ?
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.
This week we have a very simple challenge! Again due to time, I just did the first challenge this week, but I have an idea of how I'd solve the second and I'll compare with the way others implemented it.
Anyway, to the challenge. The goal is to find the 3rd smallest element of a matrix. The simplest way is simply to flatten, sort, and pick the element. There might be absolutely more performant ways to do it, such as scanning the entire matrix once and keeping a list of the lowest three as you iterate, but this is a case where I feel that it's simply not worth it. One pass to flatten and one sort isn't worth all the extra implementation complexity. I do look forward to seeing any solutions including that technique though.
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".
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.