Perl for Beginners

( 10 )
133 pages
Perl is a popular programming language, often mentioned in job adverts. It is heavily used for system admin, and for Web development.
This is a free eBook for students
Sign up for free access
Download free textbooks as PDF or read online. Less than 15% adverts
Free 30-day trial
Business subscription free for the first 30 days, then $5.99/mo
Latest eBooks
About the author

Geoffrey Sampson is a British university teacher. After studying Oriental languages and computing at the University of Cambridge and at Yale University in the USA, he spent the earlier part of his career teaching linguistics, and the later part teaching informatics, specializing in e-business and leg...


Perl is a popular programming language, often mentioned in job adverts. It is heavily used for system admin, and for Web development. And it is fun. Compared with Perl, other languages can feel worthy but tedious.

However, few universities use Perl as a teaching language. Hence the need for a self-instruction textbook, like this one.

Beginners need to focus on the core of the language, bypassing features which are not essential in the early stages. This book does that: it covers all you need to write successful Perl programs, while shielding you from confusing inessentials.

  1. Introduction
  2. Getting started
  3. Data types
  4. Operators
    1. Number and string operators
    2. Combining operator and assignment
    3. Truth-value operators
  5. Flow of control: branches
  6. Program layout
  7. Built-in functions
  8. Flow of control: loops
  9. Reading from a file
  10. Pattern matching
    1. Matching and substitution
    2. Character classes
    3. Complement classes and indefinite repetition
    4. Capturing subpatterns
    5. Alternatives
    6. Escaping special characters
    7. Greed versus anorexia
    8. Pattern-internal back-reference
    9. Transliteration
  11. Writing to a file
    1. Reading, writing, appending
    2. Pattern-matching modifier letters
    3. Generalizing special cases
  12. Arrays
    1. Tables with numbered cells
    2. An example
    3. Assigning a list to an array
    4. Adding elements to and removing them from arrays
    5. Other operations on arrays
  13. Lists
  14. Scalar versus list context
  15. Two-dimensional tables
  16. User-defined functions
    1. Adapting Perl to our own tasks
    2. The structure of a user-defined function
    3. A second example
    4. Multi-argument functions
    5. Divide and conquer
    6. Returning a list of values
    7. “Subroutines” and “functions”
  17. Hash tables
    1. Tables indexed by strings
    2. Creating a hash
    3. Working through a hash table
    4. Advantages of hash tables
    5. Hashes versus references to hashes
  18. Formatted printing
  19. Built-in variables
  20. The debugger
  21. Beyond the introduction
  22. Endnotes