Leanpub Header

Skip to main content

Modern Perl Programming

A Complete Guide from Fundamentals to Production

This book is 100% completeLast updated on 2026-07-13

Modern Perl Programming is a practical guide to writing clean, maintainable Perl code. It covers the language from the fundamentals to object-oriented programming, regular expressions, databases, and web development with Mojolicious. Whether you are learning Perl for the first time or working with an existing codebase, this book will help you build reliable applications with confidence.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

This book is a comprehensive guide to the Perl programming language for developers of all experience levels. You will learn Perl's syntax and data model, master its legendary regex engine, build object-oriented applications with modern Corinna classes, connect to databases, create real-time web applications with Mojolicious, and deploy production-grade systems. With over 47,000 distributions on CPAN, Perl remains a powerful tool for text processing, system administration, data engineering, and full-stack web development. Whether you are a seasoned programmer exploring a new language or a developer who needs to maintain legacy Perl code, this book will give you the skills and confidence to write clean, efficient, secure Perl code that works in production today.

Bundle

Bundles that include this book

Author

About the Author

Steve T. Publications

Steve T. Publications is a specialized book publishing company dedicated to delivering high-quality technical resources for IT professionals, students, educators, and technology enthusiasts. Our mission is to make complex technology concepts accessible through well-structured, practical, and industry-relevant publications.

We focus on publishing books across a wide range of information technology disciplines, including software development, cloud computing, cybersecurity, artificial intelligence, data science, networking, DevOps, databases, and enterprise technologies. Every publication is designed to bridge the gap between theory and real-world application, helping readers build the skills needed to succeed in today's rapidly evolving digital landscape.

At Steve T. Publications, we collaborate with experienced industry experts, educators, and technology professionals to produce accurate, up-to-date, and engaging content. We are committed to maintaining the highest editorial standards while empowering learners and professionals with trusted technical knowledge.

Whether you're beginning your IT journey, preparing for professional certifications, or advancing your expertise in emerging technologies, Steve T. Publications is your trusted source for authoritative and practical technical books.

Contents

Table of Contents

A Complete Guide from Fundamentals to Production

Introduction: The Language That Built the Internet

Chapter 1: What Is Perl and Why Does It Matter?

  1. The Origins of Perl: Larry Wall’s Vision
  2. Where Perl Lives Today
  3. Perl vs. Python vs. Ruby: A Fair Comparison
  4. The Perl Ecosystem at a Glance
  5. Setting Up Your Development Environment
  6. Hands-On Exercise 1.1: Your First Perl Program
  7. Mini-Project: Log File Analyzer
  8. Summary

Chapter 2: Perl Fundamentals and Syntax

  1. Scalars, Sigils, and Variable Naming
  2. Lists, Arrays, and Hashes (The Big Three)
  3. Operators: Arithmetic, String, Comparison, Logical
  4. Control Structures: if, unless, given/when
  5. Subroutines: Defining, Calling, and Signatures
  6. Hands-On Exercise 2.1: Temperature Converter
  7. Mini-Project: Word Frequency Counter
  8. Summary

Chapter 3: The Perl Regex Engine

  1. Basic Pattern Matching and the =~ Operator
  2. Quantifiers, Anchors, and Character Classes
  3. Grouping, Capturing, and Backreferences
  4. Advanced Features: Lookarounds, Atomic Groups, Possessive Quantifiers
  5. Unicode Support and Extended Character Classes
  6. Regex Performance Pitfalls and Optimization
  7. Hands-On Exercise 3.1: Email Validator
  8. Mini-Project: Log Parser with Advanced Regex
  9. Summary

Chapter 4: File I/O and Text Processing

  1. Opening, Reading, and Writing Files
  2. The Diamond Operator and ARGV Handling
  3. Directory Operations and File::Find
  4. Text Manipulation: split, join, substr, sprintf
  5. Line-by-Line Processing Patterns
  6. Hands-On Exercise 4.1: CSV Parser
  7. Mini-Project: Configuration File Parser
  8. Summary

Chapter 5: References, Data Structures, and Complex Objects

  1. What Are References? Understanding Scalar Refs
  2. Array and Hash References
  3. Nested Data Structures and Traversal
  4. The Data::Dumper and Dumper Alternatives
  5. Working with Code References and Closures
  6. Hands-On Exercise 5.1: Nested Data Structure Builder
  7. Mini-Project: INI to JSON Converter
  8. Summary

Chapter 6: Packages, Modules, and the CPAN Ecosystem

  1. Packages and Namespaces in Perl
  2. Creating Your First Module
  3. Using CPAN: cpan, cpanminus, and Carton
  4. Module Development Best Practices (Minilla)
  5. CPAN Security
  6. Hands-On Exercise 6.1: Create a Utility Module
  7. Mini-Project: CPAN Module Finder
  8. Summary

Chapter 7: Object-Oriented Programming with Corinna

  1. Perl OOP Before Corinna: Hash-Based Objects
  2. Introduction to Corinna (v5.38+)
  3. Defining Classes, Fields, and Methods
  4. Inheritance, Roles, and Composition
  5. Object Serialization and Lifecycle
  6. Hands-On Exercise 7.1: Library System
  7. Mini-Project: Task Manager with OOP
  8. Summary

Chapter 8: Error Handling and Testing

  1. Die, Carp, and Warning Strategies
  2. try/catch Blocks (Stable in v5.40)
  3. Custom Exception Classes
  4. Testing Fundamentals: TAP and Test::More
  5. Test2 Suite and Code Coverage
  6. Hands-On Exercise 8.1: Testing a Calculator Module
  7. Mini-Project: Testing Framework for Configuration Parser
  8. Summary

Chapter 9: Database Connectivity with DBI

  1. The DBI Architecture: Connectors, Handles, Drivers
  2. Connecting to SQLite, MySQL, PostgreSQL
  3. Prepared Statements and Placeholders
  4. Transaction Management and Error Recovery
  5. ORM Alternatives: DBIx::Class and Slicker
  6. Hands-On Exercise 9.1: Simple Database Application
  7. Mini-Project: Blog Database
  8. Summary

Chapter 10: Web Development with Perl

  1. The PSGI/Plack Foundation
  2. Mojolicious: Full-Stack Real-Time Framework
  3. Dancer3 for Rapid Prototyping
  4. RESTful APIs with JSON and Validation
  5. Deployment Strategies
  6. Hands-On Exercise 10.1: Simple Web Application
  7. Mini-Project: Blog API
  8. Summary

Chapter 11: Concurrency, Networking, and Automation

  1. Perl Threads (ithreads): Basics and Limitations
  2. Coro: The “Real” Threads in Perl
  3. AnyEvent and Event-Driven Programming
  4. Network Programming: Sockets and HTTP Clients
  5. System Administration Automation
  6. Hands-On Exercise 11.1: Concurrent Web Scraper
  7. Mini-Project: System Monitor
  8. Summary

Chapter 12: Security, Performance, and Modern Perl Features

  1. Taint Mode and Input Validation
  2. SQL Injection Prevention with DBI Placeholders
  3. XSS Prevention and Output Escaping
  4. Profiling with Devel::NYTProf and Benchmarking
  5. Performance Optimization Techniques
  6. Modern Perl v5.40+ Features
  7. Hands-On Exercise 12.1: Secure Web Form
  8. Mini-Project: Performance Benchmark Suite
  9. Summary

Capstone Project: Production-Grade Blog Platform

  1. Project Requirements
  2. Implementation Outline
  3. Testing

Conclusion

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

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...

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 earned over $15 million writing, 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