| |
| |
Introduction | |
| |
| |
| |
Getting Started | |
| |
| |
| |
An Introduction to Perl | |
| |
| |
What Is Perl and Where Did It Come From? | |
| |
| |
Why Learn Perl? | |
| |
| |
Getting Started Programming in Perl | |
| |
| |
An Example: The Ubiquitous Hello World | |
| |
| |
Another Example: Create Hello World As a Script | |
| |
| |
Another Example: Echo | |
| |
| |
A Third Example: The Cookie Monster | |
| |
| |
Going Deeper | |
| |
| |
| |
Working with Strings and Numbers (Scalar Data) | |
| |
| |
Scalar Data and Scalar Variables | |
| |
| |
Constructing Perl Scripts | |
| |
| |
Arithmetic Operators | |
| |
| |
One-Liners: Simple Calculator | |
| |
| |
An Example: Converting Fahrenheit to Celsius | |
| |
| |
Operators for Tests and Comparisons | |
| |
| |
Another Example: More Cookies | |
| |
| |
Going Deeper | |
| |
| |
| |
More Scalar Data and Operators | |
| |
| |
Assignment Operators | |
| |
| |
Increment and Decrement Operators | |
| |
| |
String Concatenation and Repetition | |
| |
| |
Operator Precedence and Associativity | |
| |
| |
Using Patterns to Match Digits | |
| |
| |
An Example: Simple Statistics | |
| |
| |
Input and Output | |
| |
| |
Another Example: Stocks | |
| |
| |
A Note About Using Functions | |
| |
| |
Going Deeper | |
| |
| |
| |
Working with Lists and Arrays | |
| |
| |
List Data and Variables | |
| |
| |
Defining and Using Lists and Arrays | |
| |
| |
An Example: More Stats | |
| |
| |
List and Scalar Context | |
| |
| |
Input, Output, and Lists | |
| |
| |
Going Deeper | |
| |
| |
| |
Working with Hashes | |
| |
| |
Hashes Versus Arrays and Lists | |
| |
| |
Defining and Using Hashes | |
| |
| |
An Example: Frequencies in the Statistics Program | |
| |
| |
Another Example: Alphabetical Lists of Names | |
| |
| |
A Few More Patterns | |
| |
| |
Yet Another Example: Stock Price Converter | |
| |
| |
Going Deeper | |
| |
| |
| |
Conditionals and LoopsComplex Statements and Blocks | |
| |
| |
Conditionals | |
| |
| |
while Loops | |
| |
| |
An Example: Pick a Number | |
| |
| |
Iteration with foreach and for Loops | |
| |
| |
Controlling Loops | |
| |
| |
Using the $_ (default) Variable | |
| |
| |
Input from Files with while Loops and <> | |
| |
| |
Going Deeper | |
| |
| |
| |
Exploring a Few Longer Examples | |
| |
| |
Statistics with a Better Histogram | |
| |
| |
A Number Speller | |
| |
| |
Text-to-HTML Converter Script | |
| |
| |
| |
Doing More | |
| |
| |
| |
Manipulating Lists and Strings | |
| |
| |
Array and Hash Slices | |
| |
| |
Sorting Lists | |
| |
| |
Searching | |
| |
| |
An Example: More Names | |
| |
| |
Modifying List Elements | |
| |
| |
Other Ways to Mess with Lists | |
| |
| |
Manipulating Strings | |
| |
| |
Going Deeper | |
| |
| |
| |
Pattern Matching with Regular Expressions | |
| |
| |
The Whys and Wherefores of Pattern Matching | |
| |
| |
Pattern Matching Operators and Expressions | |
| |
| |
Simple Patterns | |
| |
| |
Matching Groups of Characters | |
| |
| |
Matching Multiple Instances of Characters | |
| |
| |
An Example: A Guessing Program | |
| |
| |
More About Building Patterns | |
| |
| |
Another Example: Counting | |
| |
| |
Pattern Precedence | |
| |
| |
Going Deeper | |
| |
| |
| |
Doing More with Regular Expressions | |
| |
| |
Extracting Matches | |
| |
| |
An Example: Extracting Attributes from HTML Tags | |
| |
| |
Using Patterns for Search and Replace | |
| |
| |
More About split | |
| |
| |
Matching Patterns over Multiple Lines | |
| |
| |
A Summary of Options and Escapes | |
| |
| |
An Example: Image Extractor | |
| |
| |
Going Deeper | |
| |
| |
| |
Creating and Using Subroutines | |
| |
| |
Subroutines Versus Functions | |
| |
| |
Defining and Calling Basic Subroutines | |
| |
| |
An Example: Son of Stats | |
| |
| |
Returning Values from Subroutines | |
| |
| |
Using Local Variables in Subroutines | |
| |
| |
Passing Values into Subroutines | |
| |
| |
Subroutines and Context | |
| |
| |
Another Example: Stats with a Menu | |
| |
| |
Going Deeper | |
| |
| |
| |
Debugging Perl | |
| |
| |
Using the Debugger: A Simple Example | |
| |
| |
Starting and Running the Debugger | |
| |
| |
Perl Debugger Command Reference | |
| |
| |
Using a Graphical Debugger | |
| |
| |
Going Deeper | |
| |
| |
| |
Scope, Modules, and Importing Code | |
| |
| |
Global Variables and Packages | |
| |
| |
Local Scope and Variables | |
| |
| |
Using Perl Modules | |
| |
| |
An Example: Using the Text::Wrap Module | |
| |
| |
Using Modules from CPAN (The Comprehensive Perl Archive Network) | |
| |
| |
Going Deeper | |
| |
| |
| |
Exploring a Few Longer Examples | |
| |
| |
A Searchable Address Book (addresspl) | |
| |
| |
A Web Log Processor (weblogpl) | |
| |
| |
| |
Advanced Perl | |