Perl Weekly Challenge 269: Bitwise OR

These are some answers to the Week 269, 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 May 19, 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: Bitwise OR

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

Write a script to find out if it is possible to select two or more elements of the given array such that the bitwise OR of the selected elements has at least one trailing zero in its binary representation.

Example 1

This week in PSC (132) | 2024-01-18

We discussed

  • lwn.net writes a lot about Python. Should we let them know “Hey Perl still exists, here’s what we’re doing” too?
  • Reviewed a draft of some slides for the “Updates from the PSC” FOSDEM talk
  • Discussed some thoughts around getting use VERSION to imply builtins
  • Further clarifications were made on the PPC0019 (qt strings)

Dancer Advent Calendar 2023

Hey Dancers! We’re doing an advent calendar this year, and we’d love for you to contribute. Tell us your Dancer success story! Write about a project you worked on that used Dancer, a plugin you wrote, a plugin you love, anything.

December is coming fast, so get your ideas in now. Please reply to this post if you’d be interesting in helping with this year’s advent calendar.

2024 Perl Conference - Science Track Interest Survey

Greetings Perl People!

There is a strong official consideration by The Perl and Raku Foundation of including a new kind of track to the 2024 Perl and Raku Conference in Las Vegas.

Survey URL: https://forms.gle/DDPWsNqEsZW8AyWX7

The track would target academic and industrial STEM applications, and emulate in some way traditional science conference tracks; meaning the talks would be based on paper and poster submissions. If this came to pass, the Science Perl Committee would also follow up with the publishing of the papers in an official proceedings of this track. But we need your feedback!

Survey URL: https://forms.gle/DDPWsNqEsZW8AyWX7

Please complete and share the survey link so that we may convince the already overworked TPRC planning committee that it's worth the extra effort :-). You may also express support in the comments section below or email them directly to me so that I may forward them to the TPRF - oodler@cpan.org. There are ongoing discussions in the TPRF Slack also - see you there! A call for volunteers will be made at such a time that this proposal is accepted.

Sincerely,
Brett Estrade
oodler@cpan.org
Chairman, Science Perl Committee

Perl Weekly Challenge 268: Number Game

These are some answers to the Week 268, 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 May 12, 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: Number Game

You are given an array of integers, @ints, with even number of elements.

Write a script to create a new array made up of elements of the given array. Pick the two smallest integers and add it to new array in decreasing order i.e. high to low. Keep doing until the given array is empty.

Example 1

This week in PSC (122) | 2023-10-26

This week we discussed:

  • Release process needs better docs, maybe some more automation.
  • "inward goto" has been deprecated since 5.12. We have set an end date for it and will announce in 5.40 that we'll remove it in 5.42.
  • Our call for a project manager to get SSL into core has not gone unheeded. We're happy to accept Nicolas Mendoza to the role.
  • We need to review our notes about keeping multiple CPAN indexes from PTS in Lyon and publish them for all to see

Recordings of the German Perl Workshop (gpw2023) are online

After a long time of work, the videos are finally available on Youtube. 20 presentations with a total of 14 hours of airtime review the three days of the workshop and you can watch the things you missed on site.

We would especially like to thank Lee Johnson, who made the recordings, and the presenters, of course, without whom the workshop would not have taken place. The support from our sponsors helps us make the workshop take place.

OTOBO
united-domains
Perl-Services.de Renée Bäcker
Geizhals Preisvergleich
PayProp

The recordings of the German Perl Workshop 2023 are organised in the order of the day in a playlist available at gpw2023.

We are planning the German Perl Workshop 2024 again and are already in the final negotiations. As soon as we have a place and date fixed, we will update this post and also make a separate announcement.

Config::Tiny V 2.30 supports keys with arrays as values

Yes, it's true. Config::Tiny now allows you to assign an array of values to a key.
The docs have been updated to include a new section, ARRAY SYNTAX.
Various examples are documented there and in test files. Sample usage:

[section]
greetings[]=Hello
greetings[]=World!
one=two
Foo=Bar

Note: The 2 lines of greetings can be separated by other lines too.

You access these values like this:
say $Config->{section}->{greetings}->[0];
say $Config->{section}->{greetings}->[1]

This patch was kindly provided by Steven Schoch.

See the Changes file for details.

Perl Weekly Challenge 268: Magic Numbers

These are some answers to the Week 268, 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 May 12, 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: Magic Number

You are given two arrays of integers of same size, @x and @y.

Write a script to find the magic number that when added to each elements of one the array gives the second array. Elements order is not important.

Example 1

This week in PSC (120) | 2023-10-12

This week we discussed the following topics:

  • load_module has a PR in progress; needs continued nudging on a few last issues so we can move forward and merge it
  • Pod “U<..>” for underline has better docs; again that could possibly be merged now if all are happy
  • We spent further time thinking about other ideas for extending and improving Pod: further details may be published in due course
  • We briefly discussed how to break the logjam on PPC0013 and continue work on join/etc…

Announcing Dancer2 1.0.0

On behalf of the Dancer Core Team, I am beyond excited to present you with Dancer2 1.0.0.

So how did we get here? Why now? I'll cover the specifics in a future blog post, but suffice it to say for now, we're stable, and we've been stable for a long time, but this was never reflected in our versioning. It's beyond time to commemorate that milestone.

If you're expecting big changes, you'll be disappointed that there aren't many on the technical side. Much of what's in this release involves adding some polish in spots, and smoothing out some jagged edges in others. Some important highlights include:

Perl Weekly Challenge #237 - Carpe Diem

Hello everybody! Welcome back to the Weekly Challenge series, where today we're working on dates again. I like these challenges in particular, for some reason. In this case, we have a rather simple challenge except that it gives us less common date formats than usual.

The challenge gives us a year, month, week(day) of the month, and day of week. Now DateTime provides us with get operations to find WoM and DoW info, but it doesn't provide set operations. For that we need to do a little math. Here's the code below:

Perl Weekly Challenge 267: Line Count

These are some answers to the Week 267, 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 May 5, 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: Line Count

You are given a string, $str, and a 26-items array @widths containing the width of each character from a to z.

Write a script to find out the number of lines and the width of the last line needed to display the given string, assuming you can only fit 100 width units on a line.

Example 1

This week in PSC (119) | 2023-10-05

This week we discussed the following topics:

  • Module::CoreList is still somewhat awkward and manual to update around releases. We need better instructions and possibly some automation around the simpler
  • Pod’s new U<> format needs more documentation around its limited availability.
  • Test2::Suite sometimes spuriously fails in perl core; needs some poking
  • We should put out a call for bugfixes for a possible 5.38.1 release

plenv-libdirs

A plenv plugin to add additional include directories to Perl.

This plugin sets the contents of file .perl-libdirs. It hooks into plenv-exec command and every time you run perl or any other command under plenv, plenv-libdirs uses the .perl-libdirs files to set the PERL5LIB environment variable.

plenv-libdirs makes use of .perl-libdirs files in the current working directory and every directory between it and root. Environment variable PERL5LIB has a list of paths separated (like in PATH) by a colon on Unixish platforms and by a semicolon on Windows (the proper path separator being given by the command perl -V:path_sep). When plenv-libdirs collects the paths from .perl-libdirs files, the order of the paths follows the order of the directories. The longer the path to .perl-libdirs file, the higher precedence in PERL5LIB.

Hash of Arrays Deathmatch : Native Perl vs. DBM::Deep vs. Redis

Sometimes one has to make compromises between speed of execution and memory, other times one may not have to be. While working towards a fairly (at least in my mind) complete solution to map Nanopore Sequencing files, I ran against the need to create and access fairly large hash of arrays (think of 1M - 100Mof keys), with each array itself consisting of a a fixed number of elements.
The hash of arrays is a fairly straightforward and fast data structure to create in Perl, the memory overhead can be substantial as the number of keys and values scale upwards. While in my application (at least as envisioned now!) the hash will be created, aggregated over (group by for those into python-pandas or r-data.table vernacular) and then discarded, there are use cases in which the data should be preserved to avoid the computational expensive part of generating them via approximate string matching in biological databases.

Perl Weekly Challenge 267: Product Sign

These are some answers to the Week 267, 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 May 5, 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: Product Sign

You are given an array of @ints.

Write a script to find the sign of product of all integers in the given array. The sign is 1 if the product is positive, -1 if the product is negative and 0 if product is zero.

Example 1

Input: @ints = (-1, -2, -3, -4, 3, 2, 1)
Output: 1

The product -1 x -2 x -3 x -4 x 3 x 2 x 1 => 144 > 0

Example 2

This week in PSC (131) | 2024-01-12

We discussed

  • Some issues with PPCs in flight - meta (0022), qt strings (0019). More mails or PRs may be inbound
  • A gap in the PPC process overall; it seems unclear how to edit and amend accepted documents to resolve questions that come up during implementing

Perl Weekly Challenge #236 - Lemonade Stand

Welcome back to another round of the weekly challenge, with just one solution this week. I'm setting up a lemonade stand and need to deal with change. Interestingly, I can only sell one juice per person, so I hope you're not super thirsty!

We can take $5, $10, and $20 bills, and we don't start with any change, so we need our previous customers to provide us with change for future customers. Let's find out if we can make change for a set of customers.

Here's the code:

Writing Perl with Emacs: Are there perl-mode users around?

Emacs comes with two different major modes to edit Perl code: perl-mode and cperl-mode.

perl-mode is somewhat stuck with the Perl syntax of 5.14, has less features, but a cleaner implementation. cperl-mode is up to date with Perl 5.38 and has deeper understanding of Perl syntax, but a somewhat arcane implementation, most of it written in the previous century.

With all due respect to TIMTOWTDI, maintaining two major modes turns out to be not enough fun in the long run, and last week Stefan Kangas opened a wishlist item to Making perl-mode.el obsolete.

The mail thread shows that some people prefer perl-mode because it is less "colorful" and intrusive than cperl-mode. Therefore, the idea is to enable cperl-mode to (optionally) look like and behave like perl-mode. That way, perl-mode.el can be obsoleted without making those users uncomfortable: perl-mode would continue to exist as a custom theme of cperl-mode.

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.