Course Content
Getting Started
- Running a Perl Program
- The First Line of Your Perl Program: How Comments Work
- Line 2: Statements, Tokens, and
- Function Invocations and Arguments
- Error Messages
- Interpretive Languages Versus Compiled Languages
Basic Operators and Control Flow
- Storing in Scalar Variables Assignment
- Performing Arithmetic
- Expressions
- Other Perl Operators
- Introduction to Conditional Statements
- The if Statement
- Two-Way Branching Using if and else
- Multi-Way Branching Using elsif
- Writing Loops Using the while Statement
- Nesting Conditional Statements
- Looping Using the until Statement
Understanding Scalar Values
- What Is a Scalar Value?
- Integer Scalar Values
- Floating-Point Scalar Values
- Using Octal and Hexadecimal Notation
- Character Strings
- Interchangeability of Strings and Numeric Values
More Operators
- Using the Arithmetic Operators
- Using Comparison Operators
- Using Logical Operators
- Using Bit-Manipulation Operators
- Using the Assignment Operators
- Using Autoincrement and Autodecrement
- The String Concatenation and Repetition Operators
- Other Perl Operators
- The Order of Operations
Lists and Array Variables
- Introducing Lists
- Scalar Variables and Lists
- Storing Lists in Array Variables
- Accessing an Element of an Array Variable
- Using Lists and Arrays in Perl Programs
- Using List Ranges
- More on Assignment and Array Variables
- Retrieving the Length of a List
- Using Array Slices
- Reading an Array from the Standard Input File
- Array Library Functions
Reading from and Writing to Files
- Opening a File
- Reading from a File
- Writing to a File
- Redirecting Standard Input and Standard Output
- The Standard Error File
- Closing a File
- Determining the Status of a File
- Reading from a Sequence of Files
Pattern Matching
- Introduction
- The Match Operators
- Special Characters in Patterns
- Pattern-Matching Options
- The Substitution Operator
- The Translation Operator
- Extended Pattern-Matching
More Control Structures
- Using Single-Line Conditional Statements
- Looping Using the for Statement
- Looping Through a List: The foreach Statement
- The do Statement
- Exiting a Loop Using the last Statement
- Using next to Start the Next Iteration of a Loop
- The redo Statement
- Using Labeled Blocks for Multilevel Jumps
- The continue Block
- The goto Statement
Using Subroutines
- What Is a Subroutine?
- Defining and Invoking a Subroutine
- Returning a Value from a Subroutine
- The return Statement
- Using Local Variables in Subroutines
- Passing Values to a Subroutine
- Calling Subroutines from Other Subroutines
- Recursive Subroutines
- Passing Arrays by Name Using Aliases
- Using the do Statement with Subroutines
- Specifying the Sort Order
- Predefined Subroutines
Associative Arrays
- Limitations of Array Variables
- Definition
- Referring to Associative Array Elements
- Adding Elements to an Associative Array
- Creating Associative Arrays
- Copying Associative Arrays from Array Variables
- Adding and Deleting Array Elements
- Listing Array Indexes and Values
- Looping Using an Associative Array
- Creating Data Structures Using Associative Arrays
Formatting Your Output
- Defining a Print Format
- Displaying a Print Format
- Displaying Values in a Print Format
- Writing to Other Output Files
- Specifying a Page Header
- Setting the Page Length
- Formatting Long Character Strings
- Formatting Output Using printf
Working with the File System
- File Input and Output Functions
- Directory-Manipulation Functions
- File-Attribute Functions
- Using DBM Files
Process, String, and Mathematical Function
- Process- and Program-Manipulation Functions
- Mathematical Functions
- String-Manipulation Functions
Scalar-Conversion and List-Manipulation Functions
- The chop Function
- The chomp Function
- The crypt Function
- The hex Function
- The int Function
- The oct Function
- The ord and chr Functions
- The scalar Function
- The pack Function
- The unpack Function
- The vec Function
- The defined Function
- The undef Function
- Array and List Functions
- Associative Array Functions
System Functions
- System Library Emulation Functions
- Socket-Manipulation Functions
- The UNIX System V IPC Functions
Command-Line Options
- Specifying Options
- The -v Option: Printing the Perl Version Number
- The -c Option: Checking Your Syntax
- The -w Option: Printing Warnings
- The -e Option: Executing a Single-Line Program
- The -s Option: Supplying Your Own Command-Line Options
- The -P Option: Using the C Preprocessor
- The -I Option: Searching for C Include Files
- The -n Option: Operating on Multiple Files
- The -p Option: Operating on Files and Printing
- The -i Option: Editing Files
- The -a Option: Splitting Lines
- The -F Option: Specifying the Split Pattern
- The -0 Option: Specifying Input End-of-Line
- The -l Option: Specifying Output End-of-Line
- The -x Option: Extracting a Program from a Message
- Miscellaneous Options
- The -d Option: Using the Perl Debugger
System Variables
- Global Scalar Variables
- Pattern System Variables
- File System Variables
- Array System Variables
- Built-In File Variables
- Specifying System Variable Names as Words
References in Perl 5
- Introduction to References
- Using References
- Using the Backslash Operator
- References and Arrays
- Multidimensional Arrays
- References to Subroutines
- Using Subroutines to Work with Multiple Arrays
- References to File Handles
- Using Symbolic References… Again
- More on Hard Versus Symbolic References
Object-Oriented Programming in Perl
- An Introduction to Modules
- Classes in Perl
- Creating a Class
- Blessing a Constructor
- Methods
- Exporting Methods
- Invoking Methods
- Overrides
- Destructors
- Inheritance
- Overriding Methods
- A Few Comments About Classes and Objects in Perl
Miscellaneous Features of Perl
- The require Function
- The $#array Variables
- Alternative String Delimiters
- Special Internal Values
- Using Back Quotes to Invoke System Commands
- Pattern Matching Using ?? and the reset Function
- Other Features of the <> Operator
- Global Indirect References and Aliases
- Packages
- Modules
- Using Perl in C Programs
- Perl and CGI Scripts
- Translators and Other Supplied Code
The Perl Debugger
- Entering and Exiting the Perl Debugger
- Listing Your Program
- Stepping Through Programs
- Displaying Variable Values
- Breakpoints
- Tracing Program Execution
- Line Actions
- Other Debugging Commands