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.
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.
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.
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:
This week, we discussed some recent mailing-list threads:
meta experiments continue. They should probably provoke some kind of runtime warning about being experimental, but exact details need discussion
Ovid requests to write another PPC about value constraint checks. We don’t object as such, but would remind that a specification alone does not guarantee an implementation and we’re still busy implementing the previous big idea (class)
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on October 15, 2023 at 23:59). 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 2: Persistence Sort
You are given an array of positive integers.
Write a script to sort the given array in increasing order with respect to the count of steps required to obtain a single-digit number by multiplying its digits recursively for each array element. If any two numbers have the same count of steps, then print the smaller number first.
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:
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:
Three Perl releases have been published this past week, containing patches for security issues CVE-2023-47038 and CVE-2023-47039. This kept us busy for the past few weeks (explaining the somewhat thinner recent updates).
Paul will publish a post-mortem on the recent releases, looking at what went wrong and some thoughts on how to improve it so those don’t happen again
We discussed a plan to improve documentation of the security disclosure process
We took note of what projects we have in flight (e.g. PPCs being implemented) and may find a way to keep that list published and updated
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.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on October 1, 2023 at 23:59). 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: Exact Change
You are asked to sell juice each costs $5. You are given an array of bills. You can only sell ONE juice to each customer but make sure you return exact change back. You only have $5, $10 and $20 notes. You do not have any change in hand at first.
Write a script to find out if it is possible to sell to each customer with correct change.
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.
Paul’s TPRF grant was accepted, he plans to spend some of that time to work on some PPCs first (qt strings, overload)
FOSDEM Perl Devroom CfP: none of us are planning to attend in person, but if someone else wanted to present on our behalf we could coördinate with them and work out a subject to talk about
Discussed coming up with a Perl roadmap that we could present to the world (and entice sponsorship for TPRF’s Perl Development Fund and Grants program)
We discussed opening up our meetings to the occasional guest, so they could see what we’re actually doing (boring!) and give us an outside perspective
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.
Whohoo release 1.7 (and 1.6) brought a thorough architectural rewrite, new color spaces (HSV, HWB, YIQ), new formats ([named] array, string and css_string), choosable value ranges, closed both open issues, and introduced the named argument API I wrote last time about. And as promised, this post is about the methods: distance, set, add and blend.
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.
In the final part of this series, we will test the performance of the four parsers, in a scenario emulating the batch analysis of sequencing data. We will use the sample fastq file 3_OHara_S2_rbcLa_2019_minq7.fastq from https://zenodo.org/record/3736457. This is a 35MB file of 21791 long sequences for a nanopore experiment. Download the data and save them to a directory in your hard disk. Then use the following bash time_fastq2a_shell.txt (change the extension to .sh before running!) to process this file 500 times with each of the four methods : seqtk (C), seqkit (Go), perl - regex (code presented here saved into fastq2a_regex_comp_in_func.pl file) and perl - flag (code presented there saved into the fastq2a_flag.pl file).
Issue the following from the command line to store the timings as a tab separated file:
CGI::Tiny is a very nice, Perlish way to construct CGI scripts these days. It is perfectly suited as a replacement to CGI.pm and is quite at home in a shared hosting environment.
Here's the example from the POD [1] on metacpan:
useCGI::Tiny; cgi {my$cgi=$_;# set up error handling on $cgi# inspect request data via $cgi# set response headers if needed via $cgi# render response with $cgi->render or $cgi->render_chunk};
I recently coupled this with my new module Dispatch::Fu [2], and it worked exceedingly well. It is a darn pleasure to consider from a distance, if I do say so myself: