The Llama is Back–Revamped for Today’s Nascent Perl Programmers

Randal L. Schwartz, Tom Phoenix, and brian d foy

[amazon_link asins=’0596101058′ template=’ProductAd’ store=’orahome-21′ marketplace=’UK’ link_id=’55d7bd9c-bcd8-11e8-9f01-cf10e0cf27e7′]

ISBN: 0596101058

Pages: 283

Publisher: O’Reilly

Topic: Perl

Buy Now from Amazon

Among Perl programmers, the classic instruction books are affectionately referred to by the animals on their covers: the Camel book (“Programming Perl”), the Llama book “Learning Perl”, and a relative newcomer, the Alpaca book (“Learning Perl Objects, References, and Modules”). By no means do these books make up the entire sum of knowledge about Perl; each animal merely represents a step on the path to mastery of the language. The Llama book serves as the traditional starting point for the programmer looking to learn Perl. Newly rewritten by Randal Schwartz, Tom Phoenix, and brian d foy, three prominent members of the
Perl community, “Learning Perl, Fourth Edition” (O’Reilly) has been updated to
reflect recent changes in the language (through Perl 5.8) and the way the
language is used by programmers today.

“Learning Perl” is not a beginning programming book, but a guide to applying one’s existing programming skills to Perl. As brian d foy, lead writer for the new edition, explains, “We aimed ‘Learning Perl’ at the programmer who does not know Perl. We assume the reader understands the basics of variables, subroutines, and other features found in most programming languages, but needs to know how Perl does it. We’re not a complete reference on Perl–you’ll need ‘Programming Perl’ for that,” he adds. “But we cover the eighty percent of the language that most people use over and over again.”

Like many others, foy began his own study of Perl with the Llama book.
“I learned Perl from the first edition of the book,” he recalls.

The careful viewer will notice that I bought it a week after I got ‘Programming
Perl’.

A couple of years later, I started teaching Perl with Randal Schwartz.
Soon after that, Tom Phoenix re-jiggered most of our courseware and turned
it into the third edition of ‘Learning Perl.’ Now we’re on the fourth edition,
and I was the lead writer on the book that started it all for me.”

The fourth edition of the book includes new exercises with solutions so readers
can practice what they’ve learned while it’s still fresh in their minds. Readers
will learn about data structures, minimal matching, threading, data parsing,
references, objects, modules, package implementation, and more. The authors
have reengineered the pace and scope of the lessons with today’s Perl student in
mind, while retaining the detailed discussions, examples, and eclectic wit for which the book is famous. Although Perl was first known as the “toolbox for Unix,” knowledge of Unix isn’t required; the lessons in the new book apply equally well to most modern implementations of Perl. As foy says, “Previous editions of the book had a bit of a Unix bias, but we’ve removed as many traces of that as we could find. You can use ‘Learning Perl’ no matter which operating system or environment you’re using.”

If you ask Perl programmers today which book they relied on the most when they
were learning Perl, you’ll find that an overwhelming majority will point to
“Learning Perl.” Other books can teach you to program in Perl, but this book
will turn you into a Perl programmer.

Table of Contents

Preface
1. Introduction
Questions and Answers
What Does “Perl” Stand For?
How Can I Get Perl?
How Do I Make a Perl Program?
A Whirlwind Tour of Perl
Exercises

2. Scalar Data
Numbers
Strings
Perl’s Built-in Warnings
Scalar Variables
Output with print
The if Control Structure
Getting User Input
The chomp Operator
The while Control Structure
The undef Value
The defined Function
Exercises

3. Lists and Arrays
Accessing Elements of an Array
Special Array Indices
List Literals
List Assignment
Interpolating Arrays into Strings
The foreach Control Structure
Scalar and List Context
in List Context
Exercises

4. Subroutines
Defining a Subroutine
Invoking a Subroutine
Return Values
Arguments
Private Variables in Subroutines
Variable-Length Parameter Lists
Notes on Lexical (my) Variables
The use strict Pragma
The return Operator
Non-Scalar Return Values
Exercises
5. Input and Output
Input from Standard Input
Input from the Diamond Operator
The Invocation Arguments
Output to Standard Output
Formatted Output with printf
Filehandles
Opening a Filehandle
Fatal Errors with die
Using Filehandles
Reopening a Standard Filehandle
Exercises

6. Hashes
What Is a Hash?
Hash Element Access
Hash Functions
Typical Use of a Hash
Exercises

7. In the World of Regular Expressions
What Are Regular Expressions?
Using Simple Patterns
Character Classes
Exercises

8. Matching with Regular Expressions
Matches with m//
Option Modifiers
Anchors
The Binding Operator, =~
Interpolating into Patterns
The Match Variables
General Quantifiers
Precedence
A Pattern Test Program
Exercises

9. Processing Text with Regular Expressions
Substitutions with s///
The split Operator
The join Function
m// in List Context
More Powerful Regular Expressions
Exercises

10. 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
Exercise

11. File Tests
File Test Operators
The stat and lstat Functions
The localtime Function
Bitwise Operators
Using the Special Underscore Filehandle
Exercises

12. 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 Permissions
Changing Ownership
Changing Timestamps
Exercises

13. Strings and Sorting
Finding a Substring with index
Manipulating a Substring with substr
Formatting Data with sprintf
Advanced Sorting
Exercises

14. Process Management

Learning Perl Fourth Edition