Learn Perl Programming
Minimum price
Suggested price

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

About the Author

Asim Jalis
Asim Jalis

Asim Jalis has worked as a software developer at Microsoft, Hewlett-Packard, and Salesforce. He is a software consultant and instructor in San Francisco, and a CPAN author.

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 and for
  • 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.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 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

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub