Intermediate Perl 5 Programming

4 Day Course
Hands On

Book Now - 1 Delivery Method Available:

Classroom Virtual Classroom Private Group - Virtual Self-Paced Online


Having gained basic knowledge of Perl, this course will take you to the next level. To understand what Perl contexts really mean, rather than just accepting them, and to write most expressive code. The power of Perl file handling is extended, together with a look at low-level file IO interfaces.

With references we can take our Perl beyond mere scripts and use more complex and efficient data structures – not to mention take advantage of Object Orientation techniques.

Writing well structured applications with our own modules and subroutines requires a through understanding of how parameters are passed, how namespaces work, and how to handle errors if and when they occur.

Finally we give an overview of network and database programming with Perl – areas few programmers can avoid for long.

Every effort is made to maintain the course material at the very latest release of Perl, and new features will be discussed.


Delegates will learn how to:

  • Use all significant features of the Perl 5 programming language
  • Understand differences between Perl 5 releases
  • Develop Perl programmes containing advanced Perl constructs
  • Implement advanced data stream handling
  • Implement subroutines and modules
  • Act on Perl run-time warnings and errors, using exception handling
  • Use and implement advanced features of subroutines and modules, including OO
  • Perform pattern matching using advanced Regular Expressions
  • Use DBI interface and DBD modules to connect to a database
  • Write programs to facilitate network communication.

Training Partners

We work with the following best of breed training partners using our bulk buying power to bring you a wider range of dates, locations and prices.


Hide all

Revision, and the Perl Environment (14 topics)

  • Course objectives
  • Perl documentation
  • Interpreter environment
  • Running a perl script
  • Anatomy of a perl script
  • Perl variables
  • Some short-cut operators
  • Lexical variables (1)
  • Controlling the interpreter - Pragmas
  • Always use strictures
  • Perl 5.10 - use feature
  • Lexical variables (2)
  • Lexical pragmas
  • Perl debugging

Context and Types (15 topics)

  • Reminder: variable definitions
  • Defined and undefined scalars
  • Undefining arrays and hashes
  • Predefined variables
  • Some useful literal constants
  • The DATA file handle
  • Here documents
  • Arrays and lists
  • Comma operator
  • Array slices
  • $#array magic
  • Remember hashes?
  • Hash slices
  • The joy of x
  • Context and type conversions

Further Flow Control (18 topics)

  • Revision - basic conditionals
  • Revision - Boolean and logical operators
  • Revision - what is truth?
  • Smart match operator
  • Smart match operator is smart
  • Short circuit operators
  • Labels and loop jump statements
  • The sad case of switch/case
  • A kind-of case statement
  • Pre-5.8 use of labels and last
  • Switch / case statement (5.8)
  • The given statement - 5.9 or later
  • Loop jump statements: continue
  • Advanced for loops
  • In-line conditional operator
  • Defined-Or Operator // (5.10)
  • File condition functions
  • Evaluating file conditions

References (10 topics)

  • What are references?
  • Uses of references
  • Creating references
  • Using references
  • Dereferencing array and hash references
  • Using references
  • Examining references
  • Complex data structures
  • Data::Dumper
  • Reference counting

Advanced Subroutines (15 topics)

  • Calling a subroutine
  • Subroutine return values
  • Subroutine return values - context
  • Subroutine arguments
  • Named and default parameters
  • Parameter passing - by value?
  • Parameter passing - by reference?
  • Parameter passing - by magic
  • Explicit pass by reference
  • Subroutine prototypes
  • Prototype syntax
  • Prototypes - automatic call by reference
  • References to subroutines
  • Closures
  • Subroutine as an lvalue

Advanced List Functions (9 topics)

  • Sorting
  • Revision - array and list functions
  • List functions: reverse, sort, grep, map
  • The sort function
  • Custom sort order
  • Avoiding sort
  • Sorting hashes
  • map
  • grep

Input and Output (13 topics)

  • File handles
  • New file handles
  • Scalar variables with handles
  • The magic variable $/
  • The 'flip-flop' operator
  • Formatted output - printf
  • Changing the default output handle
  • Alternative IO functions
  • File::Find
  • The Perl IO model
  • Using sysopen
  • Reading and writing files
  • Random access

Advanced Regular Expressions (19 topics)

  • Regular Expressions in Perl
  • Review: Perl RE meta-characters
  • Regular expression quoting
  • Modifiers for regular expressions
  • Review of side-effect variables
  • Back-references
  • More capturing groups
  • Non-capturing groups
  • Other capturing variables
  • Named captures (5.10)
  • Minimal matches
  • Multi-line matches
  • Alternatives to ^ and $
  • Global matches
  • Global match progress
  • Comments in Regular Expressions
  • Substitution with interpolation
  • Look-around assertions
  • Substitution using expressions

Modules (16 topics)

  • Splitting into modules
  • Using modules
  • The library directories
  • Using subroutines from modules
  • Writing modules: structure of a module
  • Namespaces
  • Using modules without symbol export
  • Example of unconditional export
  • Example of on-demand export
  • Symbol export using tags
  • BEGIN and END blocks
  • Order of BEGIN and END blocks
  • Attaching a module with require
  • Standard modules
  • Adding modules
  • Other ways of getting modules

Handling Errors and Exceptions (18 topics)

  • Warnings and diagnostics
  • Controlling warnings
  • Error handling
  • Errno module
  • Error handling - Carp
  • Dealing with undef
  • eval
  • eval syntax
  • Error trapping using eval
  • Dying with a reference
  • Signal handling in Perl
  • Alternative signal handling
  • Sending signals
  • Timing out - alarm
  • Fake signals
  • warn and carp
  • Processing the warn and die signals
  • Errors in child processes

Object Oriented Programming (15 topics)

  • Review of Object Oriented Programming
  • Object-Oriented terminology
  • OO features in Perl
  • Basic object usage
  • Objects are references
  • Implementing objects
  • Accessing object fields
  • Constructors
  • Implementing object methods - details
  • Method calls
  • Destructors
  • Method inheritance
  • The parent pragma - 5.10.1 or later
  • Inheriting constructors
  • To OO, or not to OO?

Database Interfacing Using DBI (20 topics)

  • Perl and databases
  • The tie interface
  • Tie-ing a hash to a GDBM file
  • DBI and DBD
  • DBI objects and methods
  • Connect and disconnect
  • Driver issues with MS SQL Server
  • Options for connect
  • Life cycle of a statement
  • Placeholders
  • Reading information
  • Fetching database meta-data
  • Repeated statement execution
  • Other database handle methods
  • Database capabilities
  • Manual transaction control
  • Error handling
  • Calling a stored procedure
  • Other DBI drivers
  • Yet more DBI drivers

Network and Web Programming (16 topics)

  • Networking concepts: layers and sockets
  • Sockets are file handles
  • A basic client
  • A basic server
  • Network modules: FTP client
  • Network modules: web client
  • Network modules: sending mail
  • Program generated web pages
  • Secure Perl - taint mode
  • Running a CGI script
  • Using HTML from Perl
  • A simple CGI script
  • basic functions
  • Form handling using
  • Templates
  • Frameworks


Students should be familiar with Perl to the level of the Perl 5 Introduction course. Ideally that would be obtained by attending the course; if self-taught then the delegate should have experience at least to the level of the O’Reilly book ‘Learning Perl’. It is assumed that delegates have recent experience in writing Perl programs, and are familiar with the Perl variable types, basic file IO, simple regular expressions, and the concepts of subroutines and modules.

Additional Learning

The courses below may help you meet the knowledge level required to take this course. If you are unsure please ask a training advisor .

  • Perl 5 Introduction

    This 3-day course provides a comprehensive introduction to the Perl 5 programming language

    3 Day Course Hands On Training Course Code QAPLINTRO
    Classroom Virtual Classroom Private Group - Virtual Self-Paced Online

Course PDF


Share this Course


Recommend this Course