Sections
Personal tools

Perl Primer

 

 

Acknowledgments:


This primer is mostly a compilation of information found in two books that I highly recommend:
  • "Beginning Perl" by Simon Cozens, which can be found online at http://www.perl.org/books/beginning-perl/. This is a free book, and a great introduction to Perl programming.
  • "Perl programming for Biologists" by D. Curtis Jamison (Wiley-Liss publisher). This is a small book with many examples/problem sets related to biology. I like the way it is structured.
  • "Beginning Perl for Bioinformatics", by James Tisdall (O’Reilly publisher)


Chapter
Title Content
Handout Solutions to exercises
0 Introduction What is Perl?
How to install Perl on your computer
Your first program: "Hello World!"
PDF file Solutions:
Word file
PDF file
1 Scalar Variables Scalar variables: definition
  • Numbers:
    • Representation
    • Computation
  • Strings:
    • Basic operations: concatenate, reverse
    • Regular expressions: substitute, translate, match
  • Defining STDIN
PDF file Solutions:
Word file
PDF file
2 Lists, Arrays and Hashes
  • Lists: representations and manipulations
  • Arrays:
    • Definition
    • Adding and removing elements: push, pop, shift, unshift, splice
    • Other operators: sort, reverse
    • From arrays to strings, and back: join and split
  • Hash (or associate array):
    • Definition
    • Usage
    • Adding and removing elements
PDF file Solutions:
Word file
PDF file
3 Control structures
  • Logical expressions
  • Conditionals: if, elsif, else
  • Loops: for, foreach, while
PDF file Solutions to exercises 1 to 3:
Word file
PDF file

Program for exercises 4 to 6: DNA2Prot
4 Input/Output
  • Passing parameters to program
  • File handles
  • The input operator
PDF file Solution to problem:

program SeqAlignFasta