We provide you with a comprehensive Perl tutorial with practical examples. If you are new to Perl, this tutorial is an excellent start. If you want to review your Perl knowledge, you will find some new features of the Perl language, which has been released in the recent versions. This Perl tutorial is updated to version 5.24.
Getting Started with Perl
Powerful, stable, portable and mature, Perl is one of the most feature-rich programming languages with over two decades of development. Perl is portable and cross-platform. Currently, Perl can run on over 100 platforms. Perl is good for both mission-critical large-scale projects and rapid prototyping.
If you are new to Perl…
- First, get started quickly with Perl by following the introduction to Perl programming language.
- Second, setup a Perl development environment for practicing Perl.
- Third, develop the first program in Perl.
Basic Perl Tutorial
In this part, you are going to get familiar with the Perl language. We will show you basic Perl syntax, variables, operators and three most important data types in Perl including scalars, arrays, and hashes.
Perl Control Flow Statements
In this part, you will learn how to use Perl control flow statements including
until/do until, next,last statements. In addition, you will learn how to use a relatively new statement in Perl called
given/when statement, which is similar to the
switch case statement in C.
Perl Regular Expression
Regular expressions allow you to match text based on patterns. Perl regular expressions are powerful and very simple to use. In this part, you will learn about the basic regular expression matching techniques, character classes, alternation, grouping, substitutions, and translation.
- Basic Matching Techniques
- Character Classes
- Alternation and Grouping
- Extracting Matches
- Substitution and Translation
Perl reference is simple but very powerful. In this part, you will learn how to create array references, hash references, anonymous references, and other kinds of references. You will also learn how to use Perl references effectively in your programs.
A large Perl program is divided into reusable units of code which are known as functions or subroutines. In this part, we will show you how to define your own subroutines, how to pass parameters to the subroutine by references and values, and how to pass an array reference to subroutines.
- Perl subroutine
- Passing parameters to subroutines by reference and value
- Passing array reference to subroutines
Perl packages and modules
This part helps you understand packages and namespaces. You will learn how to define a new module in Perl.
Perl File I/O
In this part, we are going to show you how to deal with File I/O such as opening a file, reading from a file and writing to file using file handles. We’ll show you other file handling techniques using a very useful diamond operator (<>).
In this part, you will learn how to interact with databases using Perl DBI module.
Perl Object Oriented Programming
This part helps you understand about the object and the rules of Perl’s object-oriented system. In addition, you will learn how to define a class and use it in other programs.
Advanced Perl tutorial
- Perl sort – shows you various sorting techniques in Perl.
Please help us out to build a good Perl tutorial for the community by giving us your suggestions and feedback on our tutorials via the feedback form.