Learn Perl Programming
Learn Perl Programming
Through Real Examples
About the Book
This book evolved out of a course on Perl programming that I teach in the Bay Area. The engagement level in the class peaks when we write real code. This book draws on the same energy: We are going to learn by writing code.
This book is dedicated to people who know the thrill of automating tedious tasks, who like making the computer do their work for them, who like getting more done by working smarter.
This book targets people who want to learn Perl. At the end of this book you will be able to:
- Write Perl programs
- Take existing Perl programs and modify them to fit your needs
- Find useful Perl modules on CPAN and use them in your code
- Add Perl to your resumé, and apply for Perl jobs
Table of Contents
- Preface
- Who should read this book?
- Why was this book written?
- How is this book different from other books?
- Who is the author?
- How should this book be used?
- Final words
- 1 Introduction
- 1.1 What is Perl
- 1.2 Perl Resources
- 1.3 Installing Perl
- 1.4 Perl Scripts
- 1.5 Perl BAT Files
- 1.6 Perl Documentation
- 2 Perl Data Types
- 2.1 Scalars
- 2.2 Numeric Scalars
- 2.3 String Scalars
- 2.4 Perl One-Liners
- 2.5 Scalar Variables
- 2.6 Arithmetic Operators
- 2.7 Assignment Operators
- 2.8 Increment/Decrement Operators
- 2.9 String Operators
- 2.10 Unary Operators
- 2.11 Reading Input
- 2.12 Population Calculator
- 3 Control Flow
- 3.1 Using
if
,elsif
,else
- 3.2 Relational Operators
- 3.3 Ternary Operator:
$a ? $b : $c
- 3.4 Falseness
- 3.5 Logical Operators
- 3.6 Short Form
if
- 3.7 Looping with
while
andfor
- 4 Lists and Arrays
- 4.1 Creating Arrays
- 4.2 Array Operations With Side-Effects
- 4.3 Array Operations Without Side-Effects
- 4.4
@INC
Path - 5 Reading and Writing Files
- 5.1 Command Line Arguments
- 5.2 Reading Files
- 5.3 Stock Prices
- 5.4 Capturing Program Output
- 5.5 Writing and Appending to Files
- 5.6 File Test Operators
- 6 Regular Expressions
- 6.1 Pattern Matching
- 6.2 Substitution
- 6.3 Map and Grep
- 7 Hashes
- 7.1 Defining Hashes
- 7.2 Building Hashes
- 7.3 Looking Up Values
- 7.4 Looping Over Values
- 7.5 Checking For Key Existence
- 7.6 Removing Key From Hash
- 7.7 Calculating Frequencies
- 7.8 Environment Variables
- 8 Functions
- 8.1 Defining and Calling Functions
- 8.2 Useful String Functions
- 9 Array and Hash References
- 9.1 Array References
- 9.2 Hash References
- 9.3 Nesting Array References and Hash References
- 10 Object-Oriented Perl
- 10.1 Defining and Using Objects
- 10.2 CPAN and Modules
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them