Perl Basics 1

Expressions, Operators, Basic I/O

Lincoln Stein

Genome Informatics

Suggested Reading

Chapters 1, 2 & 4 of Learning Perl.

Lecture Notes

  1. What is Perl?
  2. Some simple Perl scripts
  3. Mechanics of creating a Perl script
  4. Statements
  5. Literals
  6. Operators
  7. Functions
  8. Variables
  9. Processing the Command Line
  10. Basic I/O

Problems

  1. Create a script called "add" script to sum two arguments:
          % add 2 3
          5
          
  2. Modify this script so that it checks that both arguments are present:
          % add 2
          Please provide two numeric arguments.
          
  3. Create a script called "now" to print the current time of day:
          % now
          It is now Sun Jun 6 16:35:40 1999
          
  4. Create a script to produce the reverse complement of a sequence (hint, use the reverse and tr/// functions:
          % reversec GAGAGAGAGAGTTTTTTTTT
          AAAAAAAAACTCTCTCTCTC
          

Genome Informatics


Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Mon Oct 18 14:49:45 EDT 2004