Perl Weekly Challenge 033

I continued my efforts in the Perl Weekly Challenge with solutions in Perl, Raku, and the guest language C++. I've decided to split any write-ups on the C++ solutions to a separate blog entry. This week's C++ solutions are discussed here.

Part 1

Perl

Sample Run

Raku

Sample Run

Part 2

The first attempt at this in Perl was with formats. Formatting this sort of output is a natural use for this underutilized built in ability. The fact that it is underutilized is probably almost entirely because this sort of output is much less used these days. Console output and print have long since ceded to web based reports. I noticed when reading up on formats that there was a cpan module, Perl6::Form, which allows the use of Raku's form function in Perl. I was happy to think that I could write largely the same code in both languages! Only after re-writing the Perl code to use Perl6::Form and then beginning the Raku solution did I discover that the present state of the form function in Raku is essentially non-functional. I could not  get any variables to properly interpolate into the format string. The best I could do was use it for some static header text. The rest of the table formatting is done with sprintf. If anyone is interested in a cool Raku project take a stab at updating this! The main repo for this seems to be here.

Perl

Sample Run

Raku

Sample Run

Comments for this post were locked by the author