Search for '{{search_term}}'
Perl tutorial
You'll learn how to use the CPAN and several specific CPAN modules.
It will be a good foundation for you to build on.
The free on-line version of the tutorial is currently in development. Many parts are ready. Additional parts are being published every few days. The latest one was published on May 12, 2016. If you are interested in getting updated when new parts are published, please subscribe to the newsletter.
There is also an e-book version of the material available for purchase. In addition to the free tutorial, that version also includes the slides from the corresponding course including many exercises and their solutions. The course material covers all the parts, including the areas that are not yet covered in the free version.
The companion video-course includes over 210 screencasts, a total of more than 5 hours of video. In addition to presenting the material it also provides explanations to the solutions of all the exercise. The package also includes the source code of all the examples and exercises.
Free on-line Beginner Perl Maven tutorial
In this tutorial you are going to learn how to use the Perl 5 programming language to get your job done.
You will learn both general language features, and extensions or libraries or as the Perl programmers call them modules. We will see both standard modules, that come with perl and 3rd-party modules, that we install from CPAN.
When it is possible I'll try to teach things in a very task oriented way. I'll draw up tasks and then we'll learn the necessary tools to solve them. Where possible I'll also direct you to some exercises you can do to practice what you have learned.
Introduction
- Install Perl, print Hello World, Safety net (use strict, use warnings)
- #!/usr/bin/perl - the hash-bang line
- Editors, IDEs, development environment for Perl
- Getting Help
- Perl on the command line
- Core Perl documentation, CPAN module documentation
- POD - Plain Old Documentation
- Debugging Perl scripts
Scalars
- Common warnings and error messages
- Prompt, read from STDIN, read from the keyboard
- Automatic string to number conversion
- Conditional statements: if
- Boolean (true and false) values in Perl
- Numerical operators
- String operators
- undef, the initial value and the defined function
- Strings in Perl: quoted, interpolated and escaped
- Here documents
- Scalar variables
- Comparing scalars
- String functions: length, lc, uc, index, substr
- Number Guessing game (rand, int)
- Perl while loop
- Scope of variables in Perl
- Boolean Short circuit
Files
- exit
- Standard Output, Standard Error and command line redirection
- warn
- die
- Writing to files
- Appending to files
- Open and read from files using Perl
- Don't open files in the old way
- Slurp mode
Lists and Arrays
- The for loop in Perl
- Arrays in Perl
- Process command line parameters @ARGV
- Process command line parameters using Getopt::Long
- Advanced usage of Getopt::Long for accepting command line arguments
- split
- How to read and process a CSV file? (split, Text::CSV_XS)
- join
- The year of 19100 (time, localtime, gmtime) and introducing context
- Context sensitivity in Perl
- Reading from a file in scalar and list context
- STDIN in scalar and list context
- Sorting arrays in Perl
- Sorting mixed strings
- Unique values in an array in Perl
- Manipulating Perl arrays: shift, unshift, push, pop
- Stack and queue
- reverse
- The ternary operator
- qw - quote word
Subroutines
Hashes, arrays
- Perl Hashes (dictionary, associative array, look-up table)
- Creating hash from an array
- Perl hash in scalar and list context
- Sorting a hash
- Count word frequency in a text file
Regular Expressions
- Introduction to Regular Expressions in Perl
- Regex: character classes
- Regex: special character classes
- Regex: quantifiers
- Regex videos - part I
- trim - remove leading and trailing spaces
Perl and Shell related functionality
- How to remove, copy or rename a file with Perl
- Directory handles
- Traversing directory tree manually with recursion, manually using a queue and using find.
CPAN
- Download and install Perl (Strawberry Perl or manual compilation)
- How to change @INC to find Perl modules in non-standard locations?
- How to change @INC to a relative directory
Few examples for using Perl
- How to replace a string in a file with Perl? (slurp)
- Reading Excel files using Perl
- Creating Excel files using Perl
- Sending e-mail using Perl
- CGI scripts with Perl
- Reading and writing JSON files
- Database access using Perl (DBI, DBD::SQLite, MySQL, PostgreSQL, ODBC)
- Accessing LDAP using Perl
Common warnings and error messages
- Global symbol requires explicit package name also explained in Variable declaration in Perl
- Use of uninitialized value
- Bareword not allowed while "strict subs" in use
- Name "main::x" used only once: possible typo at ...
- Unknown warnings category
- Can't use string ("Foo") as a HASH ref while "strict refs" in use at ... explained in Symbolic references in Perl
- Can't locate ... in @INC
- Scalar found where operator expected
- "my" variable masks earlier declaration in same scope
- Can't call method ... on unblessed reference
- Argument ... isn't numeric in numeric ...
- Can't locate object method "..." via package "1" (perhaps you forgot to load "1"?)
- Odd number of elements in hash assignment
- Possible attempt to separate words with commas
Other
- Splice to slice and dice arrays in Perl
- Multi dimensional arrays
- Multi dimensional hashes
- Minimal requirement to build a sane CPAN package
- What are string and numeric contexts?
- Statement modifiers: reversed if statements
Object Oriented Perl with Moose or Moo
There is a whole series of articles on writing Object Oriented code, using the light-weight Moo OOP framework or the full-blown Moose OOP framework.
Just a reminder, there are corresponding e-books and video courses available.

