As discussed earlier today in the telecon, I rewrite the detection (but not the build) script of the FFTW3 package in Perl. I attach the Perl script for your consumption; otherwise, please look at the "perl" branch of this thorn.
I am pleasantly surprised by the result. The Perl code was easier to write than the Bash code. The resulting code is also cleaner and easier to read. Support for arrays, scoped variables, and differentiating between "empty string" and "undefined variable" help a lot. Two 20-line Bash helper scripts turned into 2 lines of Perl each. I also took the opportunity to add a few self checks.
There were only two minor hiccups, namely finding the equivalents of "mkdir -p" and "date" in Perl. I solved both easily via Google ("make_path", "localtime" / "strftime").
Finally I want to remark that this script is still stand-alone. Translating another script, comparing to Steve's MPI script, and looking at Frank's bash_utils should easily identify common functions that should be put into a module.
Steve -- could you as Perl expert do me a favour and scrutinize the script for errors or ways to improve it?
-erik