Read Mastering Perl for free in Safari Online

It seems that the whole of Mastering Perl is available online for free through O’Reilly’s Safari service. I don’t even need to log in to see it. Sometimes Safari Online lets you see previews of books, but this is the whole thing. I’m not particularly concerned about that, but it was unexpected. If this is a fluke and doesn’t work for you (or disappears much later) let me know.

Read more »

Benchmarking the non-iterative, closed-form solution for Fibonacci numbers

Paul Hankin came up with a formula to calculate a Fibonacci numbers without recursively (or iteratively) generating prior ones. Don’t get too excited: his non-iterative, closed-form solution in O(n²). That means it’s slow when n is big. I was curious how well this would do in Perl. It’s very fast in Python and dog slow in Perl.

🐇 🐇 🐇 🐇 🐇

Read more »

Perl v5.26 removes . from @INC, but don’t think you’re safe!

Perl’s @INC might find code that you don’t want. That array is list of directories that use, require, and do search to find modules and libraries. By default, the last entry has been ., which represents the current working directory. That’s not a real directory; it’s a pointer to a directory you’ll discover later. There’s a fix for one consequence of this problem, but there are still issues of trust. That’s security—there are always more problems.


“Locks”, by Chilanga Cement on Flickr.

Read more »

I’ve found over 200 excellent numbers

Although Perl is no longer finding the excellent numbers, it’s still a big part of my process. Perl ran out of steam a long time ago, but it’s still managing everything.

I could do big numbers through the Math::GMP module, the time to convert between Perl data structures and GMP data structures kills performance. But, I don’t need Perl for that part. I switched to a pure C program for the number crunching part. That does make me appreciate Perl a little more as I do really common things with a lot of typing in C.
Read more »

Some interesting patterns in excellent numbers

I’ve noticed some curious patterns in excellent numbers. This relates to the Perl stuff I wrote about earlier, but this post isn’t about the Perl.

Ignoring the spaces which I use to show the pattern, each of these numbers are excellent. The pattern pivots on a 4 which can have zero or more 3s on the left side and the same number of 6s on the right side. End it all with an 8. The right half is twice the left half. I conjecture that every series of excellent numbers of a particular length has such a number. I’ll figure out the proof later: Read more »

Doing less work to compute excellent numbers

When I last looked at excellent numbers, I knew there was more work I could do to optimize what I was doing. In particular, I knew there was some upper limit to the range of numbers I had to check. I didn’t take the time to think about until today. I had a brief foray into other languages, such as my attempt with Julia, as I ran out of time to think about it. Read more »

The revolution hasn’t happened

Alan Kay says the computer revolution hasn’t happened. Here’s a talk he gave at OOPLSA in 1997. He has gems such as “I made up the term object-oriented, and I can tell you I did not have C++ in mind.” Read more »

Computing excellent numbers

In the “Benchmarking” chapter of Mastering Perl, I emphasize better algorithms over different syntax. Many of the problems we think we have better solutions if we change how we do things instead of worrying about the efficiency of a particular keyword. In this item, I’ll go through my actual path through a problem rather than hiding all my failed experiments. The negative results are just as valuable. Read more »

Ten numbers on a blackboard

In Ten numbers on a blackboard, someone asks about the largest number you can compute by reducing a set of numbers. I was surprised to see that someone spent quite a bit of time to brute force it and that their Python solution was so slow. So many of the things I write about in the “Benchmarking” and “Profiling” chapters come into play in this conversation. Read more »

Makefile.PL as a modulino

A Perl distribution’s build file is often a neglected program. The community has standards for code in the modules, but we ignore quality (or kwalitee) in Makefile.PL, the test programs, and other ancillary code.

Much of my work in CPAN Archeology has dealt with figuring out what data goes into WriteMakefile. In Test::Prereq, I took the heavy-handed and ham-fisted approach of monkey patching ExtUtils::MakeMaker just to intercept its arguments. In MyCPAN::Indexer, I run the build file and look at the generated META files. That comes with many other problems. Read more »