Perl introductionary training

From BITS wiki
Jump to: navigation, search

Why Perl for Bioinformatics ?

  • Novice programmers can learn fast to write small yet useful programs.
  • Perl regular expressions and hashes provide a powerful tool to parse through text and put it into new format or extract the interesting content. Perl provides the "glue" to connect various databanks en software into a workflow.
  • Easy parsing through files, starting software and retrieving the output, as well as retrieving data from the Internet.
  • Runs under Windows as well as MacOS X, Linux and other flavours of UNIX.
  • Freeware and OpenSource
  • Availability of collection of free software, among other things for Bioinformatics (BioPerl, Ensembl Perl,...), easy download with management of dependencies (using cpan, ppm, biocLite,...)


During these two sessions you will be invited to perform a series of exercises with the Perl scripting language in a Windows environment. There exist two versions of the Perl interpreter for Windows : Strawberry Perl and ActivePerl. The first one is a freeware and OpenSource software developed by a community of volunteers, the second belongs to ActiveState (Vancouver, Canada) and exists in a freeware basic version and a commercial version with enhancements for business purpose. We will use Strawberry Perl, which is the favorite of Larry Wall, the main developer of Perl.

You can (as you will see) always write a Perl script using any text editor and run it by simply typing a command in a "DOS box", but you will be invited to do most of the exercises using using Padre, an editor specifically designed to write Perl programs and run them right away.

Course material

Day 1

Day 2

Cheat sheets


Check your Perl Installation

  • to obtain the current version of Perl
perl –v
  • To execute Perl statements from the comment line
perl –e "print 42;"
Perl –e "print \"Two\nlines\n\";"
  • To execute and print warnings
perl –we "print 'hello';x++;"

Some further test and example of Perl flow control

  • Loops and cycles


  • Conditional Statements



Recommended Perl books

the "Perl bible" :

recommended for beginners (covers also other stuff) :

can be read on-line for free :

old but still potentially useful :

Perlbook1.gif Perlbook2.jpg Perlbook3.jpg Perlbook4.jpg Perlbook5.gif Perlbook6.gif

Additional links