Perl Examples with notes

by Bonnie Dalzell

PERL the creation of Larry Wall is a useful programming language which has the advantage of being cross platform for almost any computer OS I have encountered. I have run PERL programs on my Amigas, on Wintel OS machines, on my OS MAC and under Linux. Write once - share with many! There are even some GUI (Graphic User Interface) versions of PERL.

There is a tendency for people to orientate towards their favorite programming language with a religious fervor. I do not think that is my outlook. I used to program long ago in LOGO and in BASIC. I never learned C. I have dabbled with Tk/TCL which seems to be a pretty nice language. However I know enough PERL that I can actually accomplish making useful programs pretty quickly and taking 6 months to become as facile in a different language never seems to happen.

Here is a list of the PERL Examples I have put up to share:

animated separator bar
  1. Search-Replace-Within-File.shtml
    Opens two files, one with a numeric ID for a company, the other with the company name. Produces a third file in which the company numeric id number is replaced by the company name.
  2. a utility that allows your to search all files in a subdirectory for a word or phrase as long as it does not start with a dollar sign [$]
animated separator bar

My major PERL project is WebPed, a program to make pedigrees. It is sitting at the point where it makes pedigrees (see some examples

It still needs refinements:

  1. Right now it uses as a data file records from a spread sheet or from another pedigree program. So it needs its own front end.
  2. The COI calculation module is not yet finished.
  3. It is a command line program, not a GUI program. In some ways this is good because it will run on any platform that PERL is installed on. The user does not have to worry about installing Perl-tk which is often not installed at the same time PERL is installed.

Periodically I find myself answering a question about PERL programming. I would consider myself an intermediate level PERL programmer.

There are a large number of sites devoted to basic and advanced PERL tutorials such as A Beginner's Introduction to Perl 5.10 so I am not going to attempt to replicate those sites.

The purpose of this set of pages is to provided some working examples of PERL programs that have been useful to people who asked me how to solve a particular problem in PERL

I have included comments in the code to help you understand how things work. I have deliberately not made these programs compact and "elegant" because many of the usages which compact a program also make its logic harder to follow for a person new to a particular programming language.

These scripts are made available under the GNU/GPL license.

Here is a short list of my favorite PERL resource websites, in general you do not need to log in or provide personal information to use these sites:

  1. CPAN The Perl Archive Network, the gateway to all things Perl. The canonical location for Perl code and modules.
  2. Perl Monks A community committed to sharing Perl knowledge and coding tips. The site contains questions and answers, useful snippets, and a library of code.
  3. O'Reilly News site run by O'Reilly. Contains documentation, weekly articles, Perl development summaries, blogs, and links to a variety of resources.
  4. PERL Information Site sponsored by O'Reilly
  5. The Perl Maven Blog which has many interesting articles and tutorials. Many for no charge and also advanced ones for a subscription fee
  6. PERL Foundation The Perl Foundation is dedicated to the advancement of the Perl programming language through open discussion, collaboration, design, and code.
  7. Strawberry PERL The first Perl on any OS with out-the-box CPAN toolchain auto-upgrade support!
  8. contains the core documentation for Perl version 5.10.0, in HTML and PDF formats.
  9. Perl Enter a command in the search box and get a short tutorial on that command.

There are also a number of good PERL discussion groups at

  1. PERL Beginners questions
  2. Using Tk (and X) from Perl.
  3. Description: The Perl language in general.
  4. Perl language. (Moderated)

Nature, Natural History, Art Dog Related Links Computer related Links
Sans Souci Nursery
In Maryland, home of fine Irises, Dahlias and selected other plants for your garden.
Borzoi information site. Including articles by Bonnie Dalzell on coat color and performance
Ubuntu Linux
Free! Easy to install, easy to use, independent of Micro$oft, open source operating system which can revive your older computer.
Pictures of 17 year Locusts (Cicadas) at Hydes Maryland in 2004.
Madagascar Coton de Tulear Club of America
An independent breed registry with scientific guidance to promote the breeding of temperamentally sound healthy companion dogs., Bonnie Dalzell's computer related pages Includes Humor, HTML Lessons and Perl Lessons
Beautiful pictures of Trilobites from Ernst Heckel's Kunstformen der Natur. Bonnie Dalzell's collection of Borzoi Pedigrees online.
Over 50,000 pedigrees with ancestors color coded., Web Page Construction Lessons
Bonnie Dalzell's online portfolio
Strange and Future Beasties
The Dog Dimension: Discussions of population genetics in relation to breeding fit, healthy dogs Bonnie Dalzell's Perl Scripts, Perl Lessons and Perl Links
  Silkenswift Borzoi pages Somewhat outdated website for Bonnie Dalzell's Borzois  

Valid HTML 4.01 Transitional