Home page of Eric Pement

Home > perl.htm

   

The Perl programming language

Perl is a powerful tool, as common to web developers and GNU/Linux "power users" as pneumatic impact wrenches are to a mechanic. Perl is an all-purpose "glue language," and its flexibility makes it a choice utility capable of doing lots of stuff. Its power is accompanied by something of a learning curve, which means that it takes longer to learn Perl than it does (say) sed or awk.

Perl links and references

Make

nmake - If you download modules from CPAN, you will often need to install them with the 'make' utility. NMAKE15.EXE is a self-extracting zip file. When it's executed, it will create 3 files on your disk (nmake.exe, nmake.err, and readme.txt). Move nmake.* to c:\perl\bin, which should be on the path. Then you can run this standard perl command set for installing modules:

   perl Makeinstall.PL
   nmake
   nmake test
   nmake install

Perl thingies I've written

I haven't written too many cool things in Perl, but here are a couple of basic, simple type scripts that I'd like to share.

  • reform.pl - a script to reformat paragraphs

  • colrm.pl - column remove: a script to delete specified columns of text

  • endnote.txt - (newly updated!) This is a really helpful file for people who write documents in plain ASCII (like Emacs or vim users!), and who want to insert footnotes or endnotes in their documents, but who also want to be able to move their footnotes all around without renumbering everything. Basically, you use references like this[##] in your text, putting the actual citation (Dante, Book 3, sect. 2) directly below the paragraph. Rearrange the document to your heart's delight. When you're all finished, use this perl script to sequentially number all your references, gather your notes together, and print them at the end of the file with numbers corresponding to the in-text references. Totally cool. Eric Meyer thought of it, and I wrote it for both awk and perl. This version has just been updated.

    The same script is also available in awk if you'd rather. And since a picture is worth a thousand words, I created this file to easily show how the input and output of the endnote script.

  • biblink.pl - This is my most recent perl script, and by far the longest one I'm posting here (over 1500 lines). It is essentially a program to create HTML hyperlinks to Bible passages in a file. It looks for easy references like "John 3:16", moderate references like "Jn 8:24, 12; 10:1, 8-10" and also for harder references like "chapter 6" and "(1:7, 9; 2:1-2)", even if they break across lines. All of them are hyperlinked. This is an interactive program (required for hard references where the book name is not known), though the script remembers the last book and chapter you used and suggests a link; you type 'y' to accept it, or you can change it.

    It's being used currently at Moody Bible Institute, where I work, and is fitting our needs very well. It recognizes all common and uncommon abbreviations for books of the Bible, and even has a switch to replace "l" (lower-case L) with "1" (one) where a numeric context seems to have been intended. It also contains embedded pod (Plain Old Documentation), which you can read here for the complete details.

Newsgroups



 

These pages created with First Page, GNU Emacs, htmlpp, and Servant Salamander. Icons courtesy of Qbullets .
Last modified: Thursday, Feb 12, 2004