Perl Programming Classes
Course Outline
Programming in Perl - Beginning Class (3-days)
Basic Programming Fundamentals
Computer Memory
What are variables?
Control Structures
Making decisions
Looping
Scope in the namespace
Structured Programming Concepts
Introduction to Perl
Whirlwind Tour of Perl
How to make a Perl program
Scalar Data Types
What is scalar data?
Numbers
Strings
Perl's Built-in Warnings
Scalar variables
Output with print
The if control statement
Getting user input
The chomp operator
The while control structure
The undef value
The defined function
Lists and Arrays
What is an array?
Accessing elements of an array
Special array indices
List literals
List assignment
Interpolating arrays into strings
The foreach control structure
Perl's default $_
Scalar and List content
in List context
Subroutines
System and User functions
Defining a subroutine
Invoking a subroutine
Return values
Arguments
Private variables
The local operator
Variable-length parameter lists
The my operator
The use strict pragma
The return operator
Hashes
What is a hash?
Hash element access
Hash functions
Typical use of a hash
More on the foreach Control structure
I/O Basic
Input from Standard Input
Input from the Diamond operator
The invocation arguments
Output to Standard Output
Formatted output with printf
Programming in Perl - Intermediate Class (5-days)
Concepts of Regular Expressions
What are Regular Expressions
Using simple patterns
A pattern test program
More About Regular Expressions
Character classes
General Quantifiers
Anchors
Memory Parentheses
Precedence
Using Regular Expressions
Matches with m//
Option modifiers
The Binding Operator =~
Interpolating into patterns
The match variables
Substitution with s///
The split operator
The join operator
More Control Structures
The unless control structure
The until control structure
Expression modifiers
The Naked Block control structure
The elsif clause
Autoincrement and Autodecrement
The for control structure
Loop controls
Logical operators
Filehandles and File Tests
What is a filehandle?
Opening a filehandle
Fatal Errors with die
Using filehandles
Reopening a Standard filehandle
File tests
Directory Operations
Moving around the directory tree
Globbing
An alternate syntax for Globbing
Directory handles
Recursive Directory Listing
Manipulating Files and Directories
Removing files
Renaming files
Links and files
Making and removing directories
Modifying file permissions
Changing ownership
Changing Timestamps
Using simple Modules
Process Management
The system function
The exec function
The ENVironment variables
Using Backquotes to capture output
Processes as filehandles
Down and dirty with fork
Sending and receiving signals
Strings and Sorting
Finding a substring with index
Manipulating a substring with substr
Formatting data with sprintf
Advanced sorting
Simple Databases
DBM Files and DBM Hashes
Manipulating data with pack and unpack
Fixed-length Random-access databases
Variable-length Databases
Advanced Perl Techniques
Trapping errors with eval
Picking items from a list with grep
Transforming items from a list with map
Unquoted hash keys
More powerful Regular Expressions
Slices