The Perl Maven tutorial will teach you the basics of the Perl programming language. You'll be able to write simple scripts, analyze log files and read and write CSV files. Just to name a few common tasks.

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 October 14, 2014. 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

  1. Install Perl, print Hello World, Safety net (use strict, use warnings)
  2. #!/usr/bin/perl - the hash-bang line
  3. Editors, IDEs, development environment for Perl
  4. Getting Help
  5. Perl on the command line
  6. Core Perl documentation, CPAN module documentation
  7. POD - Plain Old Documentation
  8. Debugging Perl scripts

Scalars

  1. Common warnings and error messages
  2. Automatic string to number conversion
  3. Conditional statements: if
  4. Boolean (true and false) values in Perl
  5. Numerical operators
  6. String operators
  7. undef, the initial value and the defined function
  8. Strings in Perl: quoted, interpolated and escaped
  9. Here documents
  10. Scalar variables
  11. Comparing scalars
  12. String functions: length, lc, uc, index, substr
  13. Number Guessing game (rand, int)
  14. Perl while loop
  15. Scope of variables in Perl
  16. Boolean Short circuit

Files

  1. exit
  2. Standard Output, Standard Error and command line redirection
  3. warn
  4. die
  5. Writing to files
  6. Appending to files
  7. Open and read from files using Perl
  8. Don't open files in the old way
  9. Binary mode, dealing with Unicode
  10. Reading from a binary file, read, eof
  11. tell, seek
  12. truncate
  13. Slurp mode

Lists and Arrays

  1. Perl foreach loop
  2. The for loop in Perl
  3. Lists in Perl
  4. Using Modules
  5. Arrays in Perl
  6. Process command line parameters @ARGV
  7. Process command line parameters using Getopt::Long
  8. split
  9. How to read and process a CSV file? (split, Text::CSV_XS)
  10. join
  11. The year of 19100 (time, localtime, gmtime) and introducing context
  12. Context sensitivity in Perl
  13. Sorting arrays in Perl
  14. Sorting mixed strings
  15. Unique values in an array in Perl
  16. Manipulating Perl arrays: shift, unshift, push, pop
  17. Stack and queue
  18. reverse
  19. The ternary operator
  20. Loop controls: next and last
  21. min, max, sum using List::Util

Subroutines

  1. Subroutines and Functions in Perl
  2. Parameter passing and checking for subroutines
  3. Variable number of parameters
  4. Returning a list
  5. Recursive subroutines

Hashes, arrays

  1. Perl Hashes (dictionary, associative array, look-up table)
  2. exists, delete hash elements
  3. Sorting a hash
  4. Count word frequency in a text file

Regular Expressions

  1. Regular Expressions in Perl
  2. Regex: character classes
  3. Regex: quantifiers
  4. Regex: Greedy and non-greedy match
  5. Regex: Grouping and capturing
  6. Regex: Anchors
  7. Regex options and modifiers
  8. Substitutions (search and replace)
  9. trim - remove leading and trailing spaces

Perl and Shell related functionality

  1. Perl -X operators
  2. Perl pipes
  3. Running external programs using system
  4. Unix commands: rm, mv, chmod, chown, cd, mkdir, rmdir, ln, ls, cp
  5. How to remove, copy or rename a file with Perl
  6. Windows/DOS commands: del, ren, dir
  7. File globbing (Wildcards)
  8. Directory handles.
  9. Traversing directory tree manually with recursion, manually using a queue and using find.

CPAN

  1. Download and install Perl (Strawberry Perl or manual compilation)
  2. Download and install Perl using Perlbrew
  3. Locating and evaluating CPAN modules
  4. Downloading and installing Perl Modules from CPAN
  5. How to change @INC to find Perl modules in non-standard locations?
  6. How to change @INC to a relative directory (for Pro subscribers.)
  7. local::lib

Few examples for using Perl

  1. How to replace a string in a file with Perl? (slurp)
  2. Reading Excel files using Perl
  3. Creating Excel files using Perl (for Pro subscribers.)
  4. Sending e-mail using Perl
  5. CGI scripts with Perl
  6. Web applications with Perl: PSGI
  7. Parsing XML files
  8. Reading and writing JSON files
  9. Database access using Perl (DBI, DBD::SQLite, MySQL, PostgreSQL, ODBC)
  10. Accessing LDAP using Perl

Other

  1. Splice to slice and dice arrays in Perl
  2. How to create a Perl Module for code reuse
  3. Object Oriented Perl using Mooses
  4. Attribute types in Perl classes when using Moose
  5. Multi dimensional arrays
  6. Multi dimensional hashes
  7. Minimal requirement to build a sane CPAN package
  8. Testing a simple Perl module
  9. What are string and numeric contexts?

Object Oriented Perl with Moo

There is a whole series of articles on writing Object Oriented code, using the light-weight Moo OOP framework.


Just a reminder, there are corresponding e-books and video courses available for purchase.