Texas A&M Supercomputing Facility Texas A&M University Texas A&M Supercomputing Facility

Laboratory Exercises for Introduction to Perl

Homework: Get Acquainted With Unix

If you are a newcomer to Unix or would like a refresher, please do the following assignment outside of class:

This will review some basic commands, like changing directories, editing files, running programs, etc.. Once you are familiar with this material, you should be prepared to do the laborary exercises.

Setup Initial Directory

Before doing the exercises, you will need to create a copy of the programs and data files in a directory in your account on eos. (See alternate instructions if you are not using one of our computers.)

  1. Login to eos.
  2. Enter the following command on eos:

    /g/software/bin/init-perllab
  3. or on ada:

    /software/tamusc/local/bin/init-perllab
  4. You will be prompted to select a directory name which will be created, into which the files will be copied. The default is /scratch/USER/PerlLab/ and you can just hit the Enter key to accept that.
  5. Change to the new directory. If you used the default:

    cd /scratch/USER/PerlLab

  6. List the contents to make sure your setup is correct:

    ls

    You should see:

    Lab1 Lab2 Lab3 ... README Slides

    The Slides directory contains material from the presentation slides. The Labi directories contains the material for these exercises.
  7. Proceed to exercises.

Alternate instructions

Skip this section if you are using eos and have completed the preceding section.

  1. Login to your computer.
  2. Make sure you have perl available. Installation instructions are at perl.org.
  3. Download the exercises (Windows - zip format) (Linux/OS X - tar.gz format)
  4. Extract the files into your chosen directory (known as a "folder" on some operating systems).
  5. Open a terminal or other command-line interface.
  6. Proceed to exercises in next section.

Exercises

The following exercises should help to get you familiar with different aspects of programming Perl. There are questions, hints, and solutions available interactively, so you can go at your own pace. Feel free to skip exercises which you don't think are relevant to your work. You can always go back and do them later.

  1. Executing sample Perl scripts
  2. Conditionals and loops
  3. Reading and writing files
  4. Searching for pattern matches
  5. Processing input