1 The Practical Extraction and Report Language
1.2 What Is an Interpreted Language?
1.3.2 What Are Perl 6, Rakudo Perl, and Parrot?
1.4.2 Downloads and Other Resources for Perl (perl.org)
1.4.3 ActivePerl (activestate.com)
1.5.1 Where to Find the Most Complete Documentation from Perl
2.1 Quick Start, Quick Reference
2.1.2 A Note to Non-Programmers
2.1.3 Perl Syntax and Constructs
Passing Arguments at the Command Line
3.1.3 Statements, Whitespace, and Linebreaks
3.3 Variables (Where to Put Data)
3.3.4 Using Perl Built-in Functions
3.4.1 What Kinds of Errors to Expect
3.5.1 The -e Switch (Quick Test at the Command Line)
3.5.2 The -c Switch (Check Syntax)
3.5.3 The -w Switch (Warnings)
EXERCISE 3 Getting with It Syntactically
4 Getting a Handle on Printing
4.1 The Special Filehandles STDOUT, STDIN, STDERR
4.3.2 Literals (Numeric, String, and Special)
4.3.3 Printing Without Quotes—The here document
4.4 Fancy Formatting with the printf Function
4.4.1 Saving Formatting with the sprintf Function
4.4.2 The No Newline say Function
4.5.4 The strict Pragma and Words
5.1.1 Basic Data Types (Scalar, Array, Hash)
5.1.2 Package, Scope, Privacy, and Strictness
5.2 Scalars, Arrays, and Hashes
Output and Input Special Variables ($, and $“)
The Range Operator and Array Assignment
Looping Through an Array with the foreach Loop
Multidimensional Arrays—Lists of Lists
Removing Duplicates from a List Using a Hash
5.3.1 Adding Elements to an Array
5.3.2 Removing and Replacing Elements
The chop and chomp Functions (with Lists)
5.3.4 Searching for Elements and Index Values
5.3.5 Creating a List from a Scalar
5.3.6 Creating a Scalar from a List
5.3.9 Checking the Existence of an Array Index Value
5.4 Hash (Associative Array) Functions
5.4.4 Removing Duplicates from a List with a Hash
5.4.5 Sorting a Hash by Keys and Values
Sort Hash by Keys in Ascending Order
Sort Hash by Keys in Reverse Order
Numerically Sort a Hash by Values in Ascending Order
Numerically Sort a Hash by Values in Descending Order
EXERCISE 5 The Funny Characters
6.1 About Perl Operators—More Context
6.1.1 Evaluating an Expression
6.3 Precedence and Associativity
6.3.7 Logical Operators (Short-Circuit Operators)
6.3.9 Arithmetic Operators and Functions
6.3.10 Autoincrement and Autodecrement Operators
6.3.11 Bitwise Logical Operators
6.3.13 Special String Operators and Functions
7 If Only, Unconditionally, Forever
7.1 Control Structures, Blocks, and Compound Statements
7.1.1 Decision Making—Conditional Constructs
7.2 Statement Modifiers and Simple Statements
7.3.3 The do/while and do/until Loops
7.3.4 The for Loop (The Three-Part Loop)
7.4.4 The switch Statement (given/when)
The switch Feature (given/when/say)
EXERCISE 7 What Are Your Conditions?
8 Regular Expressions—Pattern Matching
8.1 What Is a Regular Expression?
8.1.1 Why Do We Need Regular Expressions?
8.2 Modifiers and Simple Statements with Regular Expressions
8.2.1 Pattern Binding Operators
8.3 Regular Expression Operators
8.3.1 The m Operator and Pattern Matching
The i Modifier—Case Insensitivity
Special Scalars for Saving Patterns
The x Modifier—The Expressive Modifier
8.3.2 The s Operator and Substitution
8.3.3 The Pattern Binding Operators with Substitution
Changing the Substitution Delimiters
Using the Special $& Variable in a Substitution
Pattern Matching with a Real File
EXERCISE 8 A Match Made in Heaven
9 Getting Control—Regular Expression Metacharacters
9.2 Regular Expression Metacharacters
9.2.1 Metacharacters for Single Characters
The s Modifier—The Dot Metacharacter and the Newline
9.2.2 Whitespace Metacharacters
9.2.3 Metacharacters to Repeat Pattern Matches
Metacharacters That Turn off Greediness
Metacharacters That Look Ahead and Behind
EXERCISE 9 And the Search Goes On ...
10.1 The User-Defined Filehandle
10.1.1 Opening Files—The open Function
10.1.3 Reading from a File and Scalar Assignment
The Filehandle and a User-Defined Scalar Variable
“Slurping” a File into an Array
Using map to Create Fields from a File
Slurping a File into a String with the read Function
10.1.4 Loading a Hash from a File
10.2.1 Assigning Input to a Scalar Variable
10.2.2 The chop and chomp Functions
10.2.5 Assigning Input to an Array
10.2.6 Assigning Input to a Hash
10.2.11 File Locking with flock
10.2.12 The seek and tell Functions
10.2.13 Opening for Reading and Writing
10.2.14 Opening for Anonymous Pipes
Sending the Output of a Filter to a File
10.3.2 ARGV and the Null Filehandle
10.3.4 The -i Switch—Editing Files in Place
EXERCISE 10 Getting a Handle on Things
11 How Do Subroutines Function?
11.1.1 Defining and Calling a Subroutine
11.2 Passing Arguments and the @_ Array
11.2.1 Call-by-Reference and the @_ Array
11.2.2 Assigning Values from @_
Passing a Hash to a Subroutine
11.2.4 Scoping Operators: local, my, our, and state
11.2.5 Using the strict Pragma (my and our)
11.2.6 Putting It All Together
11.2.8 Context and Subroutines
The wantarray Function and User-Defined Subroutines
11.2.10 BEGIN and END Blocks (Startup and Finish)
EXERCISE 11 I Can’t Seem to Function Without Subroutines
12 Does This Job Require a Reference?
12.1.2 References and Anonymous Variables
12.1.5 References and Subroutines
Subroutines and Passing by Reference
Filehandle References and Typeglobs
EXERCISE 12 It’s Not Polite to Point!
13 Modularize It, Package It, and Send It to the Library!
Referencing Package Variables and Subroutines from Another Package
13.2 The Standard Perl Library
Setting the PERL5LIB Environment Variable
The use Function (Modules and Pragmas)
Using Perl to Include Your Own Library
13.2.3 Exporting and Importing
13.2.4 Finding Modules and Documentation from the Standard Perl Library
Viewing the Contents of the Carp.pm Module
13.2.5 How to “Use” a Module from the Standard Perl Library
13.2.6 Using Perl to Create Your Own Module
Creating an Import Method Without Exporter
Retrieving a Module from CPAN with the cpan Shell
13.3.2 Using Perl Program Manager
13.4 Using Perlbrew and CPAN Minus
EXERCISE 13 I Hid All My Perls in a Package
14 Bless Those Things! (Object-Oriented Perl)
14.1.3 Some Object-Oriented Lingo
14.2 Perl Classes, Objects, and Methods—Relating to the Real World
14.2.2 A Complete Object-Oriented Perl Program
14.2.4 Methods Are Perl Subroutines
Creating the Object with a Constructor
Invoking the Methods (User Interaction)
14.2.5 Creating an Object-Oriented Module
Passing Parameters to Instance Methods
Named Parameters and Data Checking
14.2.6 Polymorphism and Runtime Binding
14.2.7 Destructors and Garbage Collection
14.3 Anonymous Subroutines, Closures, and Privacy
14.4.1 The @ISA Array and Calling Methods
14.4.2 $AUTOLOAD, sub AUTOLOAD, and UNIVERSAL
14.4.4 Multiple Inheritance and Roles with Moose
14.4.5 Overriding a Parent Method and the SUPER Pseudo Class
14.5 Plain Old Documentation—Documenting a Module
14.5.3 How to Use the pod Interpreters
14.5.4 Translating pod Documentation into Text
14.5.5 Translating pod Documentation into HTML
14.6 Using Objects from the Perl Library
14.6.1 An Object-Oriented Module from the Standard Perl Library
14.6.2 Using a Module with Objects from the Standard Perl Library
EXERCISE 14 What’s the Object of This Lesson?
15.2 What Is a Relational Database?
15.2.1 Client/Server Databases
15.2.2 Components of a Relational Database
15.2.3 Talking to the Database with SQL
Semicolons Terminate SQL Statements
15.3 Getting Started with MySQL
Editing Keys at the MySQL Console
Creating and Dropping a Database
15.3.5 Getting Started with Basic Commands
Creating a Database with MySQL
Selecting a Database with MySQL
Creating a Table in the Database
Adding Another Table with a Primary Key
Selecting Data from Tables—The SELECT Command
15.4.1 Installing the DBD Driver
Without the DBD-MySQL with PPM
Installing the DBD::mysql Driver from CPAN
15.4.4 Connecting to and Disconnecting from the Database
15.4.5 Preparing a Statement Handle and Fetching Results
Select, Execute, and Dump the Results
Select, Execute, and Fetch a Row As an Array
Select, Execute, and Fetch a Row As a Hash
Binding Columns and Fetching Values
15.4.7 The ? Placeholder and Parameter Binding
Binding Parameters in the execute Statement
Binding Parameters and the bind_param() Method
15.5 Statements That Don’t Return Anything
15.6.2 Perl DBI, the Web, and the Dancer Framework
EXERCISE 15 Practicing Queries and Using DBI
16 Interfacing with the System
16.1.2 Directory and File Attributes
16.1.3 Finding Directories and Files
16.1.4 Creating a Directory—The mkdir Function
16.1.5 Removing a Directory—The rmdir Function
16.1.6 Changing Directories—The chdir Function
16.1.7 Accessing a Directory via the Directory Filehandle
16.1.8 Permissions and Ownership
The link and unlink Functions (UNIX)
The symlink and readlink Functions (UNIX)
The rename Function (UNIX and Windows)
16.1.11 Changing Access and Modification Times
16.1.13 Packing and Unpacking Data
16.2.3 The Environment (UNIX and Windows)
16.2.4 Processes and Filehandles
Login Information—The getlogin Function
Special Process Variables (pid, uid, euid, gid, egid)
The Parent Process ID—The getppid Function and the $$ Variable
The Process Group ID—The pgrp Function
16.2.5 Process Priorities and Niceness
The setpriority Function (nice)
Getting a Password Entry (UNIX)—The getpwent Function
Getting a Password Entry by Username—The getpwnam Function
Getting a Password Entry by uid—The getpwuid Function
The time Function (UNIX and Windows)
The wait and waitpid Functions
16.3 Other Ways to Interface with the Operating System
16.3.1 The syscall Function and the h2ph Script
16.3.2 Command Substitution—The Backquotes
16.3.5 Globbing (Filename Expansion and Wildcards)
16.5 Signals and the %SIG Hash
16.5.2 Sending Signals to Processes
16.5.3 Attention, Windows Users!
EXERCISE 16 Interfacing with the System
A Perl Built-ins, Pragmas, Modules, and the Debugger
A.6.1 Getting Information About the Debugger
A.6.3 Entering and Exiting the Debugger
B.1.2 Executing SQL Statements
B.1.3 About SQL Commands/Queries
Semicolons Terminate SQL Statements
The SHOW and DESCRIBE Commands
B.2 SQL Data Manipulation Language (DML)
Limiting the Number of Lines in the Result Set with LIMIT
The LIKE and NOT LIKE Conditions
Pattern Matching and the % Wildcard
B.3 SQL Data Definition Language
Using a Fully Qualified Name and a Dot to Join the Tables
EXERCISE B Do You Speak My Language?
C Introduction to Moose (A Postmodern Object System for Perl 5)
C.3.2 Before and After Moose Examples
C.3.4 Example Using Moose and Extensions
C.3.5 Example Using Inheritance with Moose
18.223.237.29