Synopses & Reviews
Learning Perl, better known as "the Llama book", starts the programmer on the way to mastery. Written by three prominent members of the Perl community who each have several years of experience teaching Perl around the world, this edition has been updated to account for all the recent changes to the language up to Perl 5.8.Perl is the language for people who want to get work done. It started as a tool for Unix system administrators who needed something powerful for small tasks. Since then, Perl has blossomed into a full-featured programming language used for web programming, database manipulation, XML processing, and system administration--on practically all platforms--while remaining the favorite tool for the small daily tasks it was designed for. You might start using Perl because you need it, but you'll continue to use it because you love it.Informed by their years of success at teaching Perl as consultants, the authors have re-engineered the Llama to better match the pace and scope appropriate for readers getting started with Perl, while retaining the detailed discussion, thorough examples, and eclectic wit for which the Llama is famous.The book includes new exercises and solutions so you can practice what you've learned while it's still fresh in your mind. Here are just some of the topics covered:
- Perl variable types
- subroutines
- file operations
- regular expressions
- text processing
- strings and sorting
- process management
- using third party modules
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 point to the Llama. With good reason. Other books may teach you to program in Perl, but this book will turn you into a Perl programmer.
About the Author
Randal L. Schwartz is a two-decade veteran of the software industry. He is skilled in software design, system administration, security, technical writing, and training. Randal has coauthored the "must-have" standards: Programming Perl, Learning Perl, Learning Perl for Win32 Systems, and Effective Perl Learning, and is a regular columnist for WebTechniques, PerformanceComputing, SysAdmin, and Linux magazines.
He is also a frequent contributor to the Perl newsgroups, and has moderated comp.lang.perl.announce since its inception. His offbeat humor and technical mastery have reached legendary proportions worldwide (but he probably started some of those legends himself). Randal's desire to give back to the Perl community inspired him to help create and provide initial funding for The Perl Institute. He is also a founding board member of the Perl Mongers (perl.org), the worldwide Perl grassroots advocacy organization. Since 1985, Randal has owned and operated Stonehenge Consulting Services, Inc. Randal can be reached for comment at [email protected] or (503) 777-0095, and welcomes questions on Perl and other related topics.
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.
brian d foy is a prolific Perl trainer and writer, and runs The Perl Review to help people use and understand Perl through educational, consulting, code review, and more. He's a frequent speaker at Perl conferences. He's the coauthor of Learning Perl, Intermediate Perl, and Effective Perl Programming, and the author of Mastering Perl. He was an instructor and author for Stonehenge Consulting Services from 1998 to 2009, a Perl user since he was a physics graduate student, and a die-hard Mac user since he first owned a computer. He founded the first Perl user group, the New York Perl Mongers, as well as the Perl advocacy nonprofit Perl Mongers, Inc., which helped form more than 200 Perl user groups across the globe. He maintains the perlfaq portions of the core Perl documentation, several modules on CPAN, and some standalone scripts.
Table of Contents
Preface; History of This Book; Typographical Conventions; Using Code Examples; How to Contact Us; Safari Enabled; Acknowledgments; Chapter 1: Introduction; 1.1 Questions and Answers; 1.2 What Does "Perl" Stand For?; 1.3 How Can I Get Perl?; 1.4 How Do I Make a Perl Program?; 1.5 A Whirlwind Tour of Perl; 1.6 Exercises; Chapter 2: Scalar Data; 2.1 Numbers; 2.2 Strings; 2.3 Perl's Built-in Warnings; 2.4 Scalar Variables; 2.5 Output with print; 2.6 The if Control Structure; 2.7 Getting User Input; 2.8 The chomp Operator; 2.9 The while Control Structure; 2.10 The undefscalar variablesundef Value; 2.11 The definedfunctionsdefined Function; 2.12 Exercises; Chapter 3: Lists and Arrays; 3.1 Accessing Elements of an Array; 3.2 Special Array Indices; 3.3 List Literals; 3.4 List Assignment; 3.5 Interpolating Arrays into Strings; 3.6 The foreach Control Structure; 3.7 Scalar and List Context; 3.8
in List Context; 3.9 Exercises; Chapter 4: Subroutines; 4.1 Defining a Subroutine; 4.2 Invoking a Subroutine; 4.3 Return Values; 4.4 Arguments; 4.5 Private Variables in Subroutines; 4.6 Variable-Length Parameter Lists; 4.7 Notes on Lexical (my) Variables; 4.8 The use strictpragmasuse strict Pragma; 4.9 The returnoperatorsreturn Operator; 4.10 Non-Scalar Return Values; 4.11 Exercises; Chapter 5: Input and Output; 5.1 Input from Standard Input; 5.2 Input from the Diamond Operator; 5.3 The Invocation Arguments; 5.4 Output to Standard Output; 5.5 Formatted Output with printf; 5.6 Filehandles; 5.7 Opening a Filehandle; 5.8 Fatal Errors with die; 5.9 Using Filehandles; 5.10 Reopening a Standard Filehandle; 5.11 Exercises; Chapter 6: Hashes; 6.1 What Is a Hash?; 6.2 Hash Element Access; 6.3 Hash Functions; 6.4 Typical Use of a Hash; 6.5 Exercises; Chapter 7: In the World of Regular Expressions; 7.1 What Are Regular Expressions?; 7.2 Using Simple Patterns; 7.3 Character Classes; 7.4 Exercises; Chapter 8: Matching with Regular Expressions; 8.1 Matches with m//; 8.2 Option Modifiers; 8.3 Anchors; 8.4 The Binding Operator, =~; 8.5 Interpolating into Patterns; 8.6 The Match Variables; 8.7 General Quantifiers; 8.8 Precedence; 8.9 A Pattern Test Program; 8.10 Exercises; Chapter 9: Processing Text with Regular Expressions; 9.1 Substitutions with s///; 9.2 The split Operator; 9.3 The joinfunctionsjoin Function; 9.4 m// inlist contextm// in List Context; 9.5 More Powerful Regular Expressions; 9.6 Exercises; Chapter 10: More Control Structures; 10.1 The unlesscontrol structuresunless Control Structure; 10.2 The untilcontrol structuresuntil Control Structure; 10.3 Expression Modifiers; 10.4 The Naked Block Control Structure; 10.5 The elsif Clause; 10.6 Autoincrement and Autodecrement; 10.7 The forcontrol structuresfor Control Structure; 10.8 Loop Controls; 10.9 Logical Operators; 10.10 Exercise; Chapter 11: File Tests; 11.1 File Test Operators; 11.2 The statfunctionsstat and lstatfunctionslstat Functions; 11.3 The localtimefunctionslocaltime Function; 11.4 Bitwise Operators; 11.5 Using the Special Underscore Filehandle; 11.6 Exercises; Chapter 12: Directory Operations; 12.1 Moving Around the Directory Tree; 12.2 Globbing; 12.3 An Alternate Syntax for Globbing; 12.4 Directory Handles; 12.5 Recursive Directory Listing; 12.6 Manipulating Files and Directories; 12.7 Removing Files; 12.8 Renaming Files; 12.9 Links and Files; 12.10 Making and Removing Directories; 12.11 Modifying Permissions; 12.12 Changing Ownership; 12.13 Changing Timestamps; 12.14 Exercises; Chapter 13: Strings and Sorting; 13.1 Finding a Substring with index; 13.2 Manipulating a Substring with substr; 13.3 Formatting Data with sprintf; 13.4 Advanced Sorting; 13.5 Exercises; Chapter 14: Process Management; 14.1 The system Function; 14.2 The execfunctionsexec Function; 14.3 The Environment Variables; 14.4 Using Backquotes to Capture Output; 14.5 Processes as Filehandles; 14.6 Getting Down and Dirty with fork; 14.7 Sending and Receiving Signals; 14.8 Exercises; Chapter 15: Perl Modules; 15.1 Finding Modules; 15.2 Installing Modules; 15.3 Using Simple Modules; 15.4 Exercise; Chapter 16: Some Advanced Perl Techniques; 16.1 Trapping Errors with eval; 16.2 Picking Items from a List with grep; 16.3 Transforming Items from a List with map; 16.4 Unquoted Hash Keys; 16.5 Slices; 16.6 Exercise; Exercise Answers; Answers to Chapter 2 Exercises; Answers to Chapter 3 Exercises; Answers to Chapter 4 Exercises; Answers to Chapter 5 Exercises; Answers to Chapter 6 Exercises; Answers to Chapter 7 Exercises; Answers to Chapter 8 Exercises; Answers to Chapter 9 Exercises; Answer to Chapter 10 Exercise; Answers to Chapter 11 Exercises; Answers to Chapter 12 Exercises; Answers to Chapter 13 Exercises; Answers to Chapter 14 Exercises; Answer to Chapter 15 Exercise; Answer to Chapter 16 Exercise; Beyond the Llama; Further Documentation; Regular Expressions; Packages; Extending Perl's Functionality; Some Important Modules; Pragmas; Databases; Other Operators and Functions; Mathematics; Lists and Arrays; Bits and Pieces; Formats; Networking and IPC; Security; Debugging; The Common Gateway Interface (CGI); Command-Line Options; Built-in Variables; Syntax Extensions; References; Tied Variables; Operator Overloading; Dynamic Loading; Embedding; Converting Other Languages to Perl; Converting find Command Lines to Perl; Command-Line Options in Your Programs; Embedded Documentation; More Ways to Open Filehandles; Locales and Unicode; Threads and Forking; Graphical User Interfaces (GUIs); And More . . .; Colophon;
Tech Q&A
Read the Tech Q&A with Brian D. Foy