Book description
Perl is a complex language that can be difficult to master. Perl advocates boast that "There's More Than One Way To Do It", but do you really want to learn several ways of saying the same thing to a computer?
To make Perl more accessible, Dr. Tim Maher has over the years designed and taught an essential subset of the language that is smaller, yet practical and powerful. With this engaging book you can now benefit from "Mininal Perl" even if all you know about Unix is grep.
In Minimal Perl, you will learn how to write simple Perl commands (many just one-liners) that go far beyond the limitations of Unix utilities, and those of Linux, MacOS/X, etc. And you'll acquire the more advanced Perl skills used in scripts by capitalizing on your knowledge of related Shell resources. Sprinkled throughout are many Unix-specific Perl tips.
About the Technology
About the Book
What's Inside
- A simpler, yet still powerful Perl
- Development of concise commands and flexible scripts
- How to package custom software in reusable modules
- How to exploit CPAN modules to avoid reinventing the wheel
- Language features in tabular summaries
- 100+ reusable programs for: system administration, web development (HTML, CGI, Forms), networking, databases, finance, text analysis, and more
About the Reader
This book is especially suitable for system administrators, webmasters, and software developers.
About the Author
Dr. Tim Maher's multi-decade career as a software professional includes stints at U.C. Berkeley as the Humanities Computer Consultant, at the University of Utah as a Professor of Computer Science, and at AT&T, Sun Microsystems, Hewlett Packard, and Consultix as a Course Developer/Lecturer on operating systems and programming languages. Along the way, he's taught UNIX, Linux, or Perl to many thousands of individuals—ranging from technology-phobic poets to corporate IT engineers. Tim founded Seattle's Perl Users Group, and served as its leader for six years. Many of its 400+ members contributed useful ideas to this book. In his spare time, he enjoys the natural beauty of the Pacific Northwest, where he lives.
Quotes
If you are a Unix/Linux user and wish to learn Perl, I recommend this book.
- George Wooley, Camelot.pm and Oakland.pm
This book is not perl tapas. It is a survival tool.
- William M. Julien, Fortune 100 Company
No-nonsense and practical, yet with wit and charm. A joy to read.
- Dan Sanderson, Software Developer
Shows style, not just facts, valuable.
- Brian Downs, Lucent Technologies
Brilliant, never tedious, highly recommended!
- Jon Allen, Maintainer of perldoc.perl.org
You could have chosen no better primer that this book.
- Damian Conway, from the Foreword
Table of contents
- Copyright
- Foreword
- Preface
- Acknowledgments
- About this Book
- About the Cover Illustration
- Tables
-
1. Minimal Perl: for UNIX and Linux Users
- 1. Introducing Minimal Perl
-
2. Perl essentials
- 2.1. Perl’s invocation options
- 2.2. Using variables
- 2.3. Loading modules: -M
- 2.4. Writing simple scripts
- 2.5. Additional special variables
- 2.6. Standard option clusters
- 2.7. Constructing programs
- 2.8. Summary
-
3. Perl as a (better) grep command
- 3.1. A brief history of grep
- 3.2. Shortcomings of grep
- 3.3. Working with the matching operator
- 3.4. Understanding Perl’s regex notation
- 3.5. Perl as a better fgrep
- 3.6. Displaying the match only, using $&
- 3.7. Displaying unmatched records (like grep -v)
- 3.8. Displaying filenames only (like grep -l)
- 3.9. Using matching modifiers
- 3.10. Perl as a better egrep
- 3.11. Matching in context
- 3.12. Spanning lines with regexes
- 3.13. Additional examples
- 3.14. Summary
-
4. Perl as a (better) sed command
- 4.1. A brief history of sed
- 4.2. Shortcomings of sed
- 4.3. Performing substitutions
- 4.4. Printing lines by number
- 4.5. Modifying templates
- 4.6. Converting special characters
- 4.7. Editing files
- 4.8. Converting to lowercase or uppercase
- 4.9. Substitutions with computed replacements
- 4.10. The sed to Perl translator
- 4.11. Summary
-
5. Perl as a (better) awk command
- 5.1. A brief history of AWK
- 5.2. Comparing basic features of awk and Perl
- 5.3. Processing fields
- 5.4. Programming with Patterns and Actions
- 5.5. Matching ranges of records
- 5.6. Using relational and arithmetic operators
- 5.7. Using built-in functions
- 5.8. Additional examples
- 5.9. Using the AWK-to-Perl translator: a2p
- 5.10. Summary
- 6. Perl as a (better) find command
-
2. Minimal Perl: for UNIX and Linux Shell Programmers
-
7. Built-in functions
- 7.1. Understanding and managing evaluation context
- 7.2. Programming with functions that generate or process scalars
- 7.3. Programming with functions that process lists
- 7.4. Globbing for filenames
- 7.5. Managing files with functions
- 7.6. Parenthesizing function arguments
- 7.7. Summary
-
8. Scripting techniques
- 8.1. Exploiting script-oriented functions
- 8.2. Pre-processing arguments
- 8.3. Executing code conditionally with if/else
- 8.4. Wrangling strings with concatenation and repetition operators
- 8.5. Interpolating command output into source code
- 8.6. Executing OS commands using system
- 8.7. Evaluating code using eval
- 8.8. Summary
-
9. List variables
- 9.1. Using array variables
-
9.2. Using hash variables
- 9.2.1. Initializing hashes
- 9.2.2. Understanding advanced hash indexing
- 9.2.3. Understanding the built-in %ENV hash
- 9.2.4. Printing hashes
- 9.2.5. Using %ENV in place of switches
- 9.2.6. Obtaining uniqueness with hashes
- 9.2.7. Employing a hash as a simple database: The user_lookup script
- 9.2.8. Counting word frequencies in web pages: The count_words script
- 9.3. Comparing list generators in the Shell and Perl
- 9.4. Summary
- 10. Looping facilities
-
11. Subroutines and variable scoping
- 11.1. Compartmentalizing code with subroutines
- 11.2. Common problems with variables
- 11.3. Controlling variable scoping
-
11.4. Variable Scoping Guidelines for complex programs
- 11.4.1. Enable use strict
- 11.4.2. Declare user-defined variables and define their scopes
- 11.4.3. Pass data to subroutines using arguments
- 11.4.4. Localize temporary changes to built-in variables with local
- 11.4.5. Employ user-defined loop variables
- 11.4.6. Applying the Guidelines: the phone_home2 script
- 11.5. Reusing a subroutine
- 11.6. Summary
-
12. Modules and the CPAN
- 12.1. Creating modules
- 12.2. Managing modules
- 12.3. Using modules
- 12.4. Summary
-
7. Built-in functions
- Epilogue
- A. Perl special variables cheatsheet
- B. Guidelines for parenthesizing code
- Glossary
- How to use this index
Product information
- Title: Minimal Perl
- Author(s):
- Release date: October 2006
- Publisher(s): Manning Publications
- ISBN: 9781932394504
You might also like
book
Beginning Perl
Everything beginners need to start programming with Perl Perl is the ever-popular, flexible, open source programming …
book
Think Perl 6
Want to learn how to program and think like a computer scientist? This practical guide gets …
book
Pro Perl
Over the years, Perl has grown from an elegant scripting tool into a mature and full-featured …
book
Perl by Example
The World’s Easiest Perl 5 Tutorial—Updated for Today’s Applications and “Modern Perl” Best Practices “When I …