Cover image for Learning Perl
Title:
Learning Perl
Author:
Schwartz, Randal L.
Personal Author:
Edition:
Third edition.
Publication Information:
Sebastopol, CA : O'Reilly, [2001]

©2001
Physical Description:
xvi, 316 pages : illustrations ; 24 cm
Language:
English
Added Author:
ISBN:
9780596001322
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Central Library QA76.73.P225 S39 2001 Adult Non-Fiction Central Closed Stacks
Searching...

On Order

Summary

Summary

If you ask Perl programmers today what book they relied on most when they were learning Perl, you'll find that an overwhelming majority will name Learning Perl --also known affectionately as "the Llama." The first edition of Learning Perl appeared in 1993 and has been a bestseller ever since. Written by two of the most prominent and active members of the Perl community, this book is the quintessential tutorial for the Perl programming language.Perl began as a tool for Unix system administrators, used for countless small tasks throughout the workday. It has since blossomed into a full-featured programming language on practically every computing platform, and is used for web programming, database manipulation, XML processing, and (of course) system administration--all this while still remaining the perfect tool for the small daily tasks it was designed for. Perl is quick, fun, and eminently useful. Many people start using Perl because they need it, but they continue to use Perl because they love it.The third edition of Learning Perl has not only been updated for Perl 5.6, but has also been rewritten from the ground up to reflect the needs of programmers learning Perl today. Informed by their years of success at teaching Perl as consultants, the authors have re-engineered the book to better match the pace and scope appropriate for readers trying to get started with Perl, while retaining the detailed discussion, thorough examples, and eclectic wit for which the book is famous.This edition of the Llama includes an expanded and more gently-paced introduction to regular expressions, new exercises and solutions designed so readers can practice what they've learned while it's still fresh in their minds, and an overall reworking to bring Learning Perl into the new millennium.Perl is a language for getting your job done. Other books may teach you to program in Perl, but this book will turn you into a Perl programmer.


Author Notes

Tom Phoenix has been working in the field of education since 1982. After more than thirteen years of dissections, explosions, work with interesting animals, and high-voltage sparks during his work at a science museum, he started teaching Perl classes for Stonehenge Consulting Services, where he's worked since 1996. Since then, he has traveled to many interesting locations, so you might see him soon at a Perl Mongers' meeting. When he has time, he answers questions on Usenet's comp.lang.perl.misc and comp.lang.perl.moderated newsgroups, and contributes to the development and usefulness of Perl. Besides his work with Perl, Perl hackers, and related topics, Tom spends his time on amateur cryptography and speaking Esperanto. His home is in Portland, Oregon.


Table of Contents

Prefacep. xi
1. Introductionp. 1
Questions and Answersp. 1
What Does "Perl" Stand For?p. 4
How Can I Get Perl?p. 8
How Do I Make a Perl Program?p. 12
A Whirlwind Tour of Perlp. 17
Exercisesp. 18
2. Scalar Datap. 19
What Is Scalar Data?p. 19
Numbersp. 19
Stringsp. 22
Perl's Built-in Warningsp. 26
Scalar Variablesp. 27
Output with printp. 29
The if Control Structurep. 34
Getting User Inputp. 35
The chomp Operatorp. 36
The while Control Structurep. 37
The undef Valuep. 37
The defined Functionp. 38
Exercisesp. 39
3. Lists and Arraysp. 40
Accessing Elements of an Arrayp. 41
Special Array Indicesp. 42
List Literalsp. 43
List Assignmentp. 45
Interpolating Arrays into Stringsp. 47
The foreach Control Structurep. 48
Perl's Favorite Default: $_p. 49
Scalar and List Contextp. 51
[left angle bracket]STDIN[right angle bracket] in List Contextp. 54
Exercisesp. 55
4. Subroutinesp. 56
System and User Functionsp. 56
Defining a Subroutinep. 57
Invoking a Subroutinep. 57
Return Valuesp. 58
Argumentsp. 60
Private Variables in Subroutinesp. 62
The local Operatorp. 63
Variable-length Parameter Listsp. 64
Notes on Lexical (my) Variablesp. 67
The use strict Pragmap. 68
The return Operatorp. 69
Exercisesp. 71
5. Hashesp. 73
What Is a Hash?p. 73
Hash Element Accessp. 76
Hash Functionsp. 80
Typical Use of a Hashp. 83
Exercisesp. 84
6. I/O Basicsp. 86
Input from Standard Inputp. 86
Input from the Diamond Operatorp. 88
The Invocation Argumentsp. 90
Output to Standard Outputp. 91
Formatted Output with printfp. 94
Exercisesp. 96
7. Concepts of Regular Expressionsp. 98
What Are Regular Expressions?p. 98
Using Simple Patternsp. 100
A Pattern Test Programp. 102
Exercisesp. 103
8. More About Regular Expressionsp. 105
Character Classesp. 105
General Quantifiersp. 107
Anchorsp. 108
Memory Parenthesesp. 109
Precedencep. 111
Exercisesp. 113
9. Using Regular Expressionsp. 115
Matches with m//p. 115
Option Modifiersp. 116
The Binding Operator, =~p. 117
Interpolating into Patternsp. 118
The Match Variablesp. 119
Substitutions with s///p. 122
The split Operatorp. 125
The join Functionp. 126
Exercisesp. 127
10. More Control Structuresp. 128
The unless Control Structurep. 128
The until Control Structurep. 129
Expression Modifiersp. 130
The Naked Block Control Structurep. 131
The elsif Clausep. 132
Autoincrement and Autodecrementp. 133
The for Control Structurep. 135
Loop Controlsp. 138
Logical Operatorsp. 142
Exercisep. 147
11. Filehandles and File Testsp. 148
What Is a Filehandle?p. 148
Opening a Filehandlep. 150
Fatal Errors with diep. 152
Using Filehandlesp. 155
Reopening a Standard Filehandlep. 157
File Testsp. 157
Exercisesp. 167
12. Directory Operationsp. 168
Moving Around the Directory Treep. 168
Globbingp. 169
An Alternate Syntax for Globbingp. 170
Directory Handlesp. 171
Recursive Directory Listingp. 173
Exercisesp. 173
13. Manipulating Files and Directoriesp. 174
Removing Filesp. 174
Renaming Filesp. 176
Links and Filesp. 177
Making and Removing Directoriesp. 182
Modifying Permissionsp. 184
Changing Ownershipp. 184
Changing Timestampsp. 185
Using Simple Modulesp. 185
Exercisesp. 190
14. Process Managementp. 192
The system Functionp. 192
The exec Functionp. 195
The Environment Variablesp. 196
Using Backquotes to Capture Outputp. 197
Processes as Filehandlesp. 201
Getting Down and Dirty with Forkp. 203
Sending and Receiving Signalsp. 204
Exercisesp. 206
15. Strings and Sortingp. 208
Finding a Substring with indexp. 208
Manipulating a Substring with substrp. 209
Formatting Data with sprintfp. 211
Advanced Sortingp. 213
Exercisesp. 219
16. Simple Databasesp. 221
DBM Files and DBM Hashesp. 221
Manipulating Data with pack and unpackp. 224
Fixed-length Random-access Databasesp. 225
Variable-length (Text) Databasesp. 228
Exercisesp. 232
17. Some Advanced Perl Techniquesp. 233
Trapping Errors with evalp. 233
Picking Items from a List with grepp. 236
Transforming Items from a List with mapp. 237
Unquoted Hash Keysp. 238
More Powerful Regular Expressionsp. 239
Slicesp. 242
Exercisep. 247
A. Exercise Answersp. 249
B. Beyond the Llamap. 281
Indexp. 303

Google Preview