John Macdonald, co-author of Mastering Algorithms with Perl, is a long-time user of Perl for Unix system administration tools. His background includes work on compilers, kernel internals, and device drivers. Betsy Waliszewski was able to pry him away from his work to answer a few questions about this best-selling book.
In the abstract, the choice of programming environment doesn't matter to studying algorithms. The change in performance from one to the next will be a constant factor. Amongst peer environments that factor will usually be small, but even if it is a factor of 1,000 it is generally not important. Using the wrong algorithm can change run times from seconds to centuries--from trivial to impossible, regardless of the environment.
In practice, of course, it does matter. While you're reading about algorithms, you want to understand the code; if it is written in a familiar language your task is easier. And once you've progressed from studying, and have determined the right algorithm to use, there is still the matter of using it. There is a vast difference between copying or downloading code that is written in the language you need and translating pseudo-code into your language.
So, for a programmer who uses Perl, an algorithms book based on Perl is very useful.
It's hard to do adequate justice to all of them; the book ended up with about 50% more pages than the original guesstimate.
Things that can have an effect are:
Coding directly or using a separate module is not an either-or proposition. When the code for an operation is so simple that you can type it in the middle of an expression without error, you'll tend to just write it as you go. If the way to write the code is highly dependent upon the context, you'll also tend to write it as you go. If the algorithm is harder to get right, putting it in a canned module is best.
Knuth points out that many decades passed after the binary search algorithm was described and when the first error-free implementation was published.
Perl will continue to evolve and grow, because it has a group of extremely talented people making that happen.
Copyright © 2007 O'Reilly Media, Inc.