Outline

Introduction #

  • Why use Perl?
  • How does it compare to other languages?
  • Where’s it heading?

Installation #

  • How and where to get Perl
  • The environment in our classroom
  • Other configurations

Running a Perl Script #

  • Command-line vs. script files
  • Command-line switches
  • Editing and running a script

Numbers #

  • Numeric literals
  • Arithmetic operators

Strings #

  • String literals
  • String operators

Formatting Output #

Scalar Variables #

  • What are scalars and how are they used?
  • Variable interpolation

Getting Input #

  • The STDIN predefined filehandle
  • chomp vs. chop

Arrays #

  • Creating and accessing arrays
  • Undefined array items
  • Printing arrays
  • Finding the size of an array
  • Array slices
  • Lists vs. arrays

More About Arrays #

  • The split and join functions
  • The reverse function
  • Other array functions

Associative Arrays (Hashes) #

  • What are hashes?
  • Creating and accessing hashes
  • Hash functions
  • Common uses for hashes

Control Structures #

  • What is a code block?
  • Conditional operators and expressions
  • True and false
  • If-then-else statements
  • TMTOWTDI

Loops #

  • Code blocks and labels
  • while loops
  • Loop control
  • for loops
  • foreach loops
  • The “default variable”

Reading and writing files #

  • Opening and closing filehandles
  • Passing arguments to Perl scripts
  • The die function
  • Different ways to read the contents of a file

Talking to the Operating System #

  • Using OS commands as input

Regular Expressions #

  • Syntax for matching, substitutions and translations
  • Constructing regular expressions

Subroutines #

  • Reasons for using subroutines
  • CPAN and modules