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 15, 2013. 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)
- Editors, IDEs, development environment for Perl
- Perl on the command line
- Core Perl documentation, CPAN module documentation
- POD - Plain Old Documentation
- Debugging Perl scripts
Scalars
- Common warnings and error messages
- Automatic string to number conversion
- Conditional statements: if
- Boolean (true and false) values in Perl
- Numerical and 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
Files
- die, warn and exit
- Writing to files
- Appending to files
- Open and read from files using Perl
- Don't open files in the old way
- Binary mode, dealing with Unicode
- Reading from a binary file, read, eof
- tell, seek
- truncate
Lists and Arrays
- Perl foreach loop
- The for loop in Perl
- Lists in Perl
- Using Modules
- Arrays in Perl
- Process command line parameters @ARGV, Getopt::Long
- 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
- Sorting arrays in Perl
- Unique values in an array in Perl
- Manipulating Perl arrays: shift, unshift, push, pop
- Stack and queue
- reverse
- the ternary operator
- Loop controls: next and last
- min, max, sum using List::Util
Subroutines
- Subroutines and Functions in Perl
- Parameter passing and checking for subroutines
- Variable number of parameters
- Returning a list
- Recursive subroutines
Hashes, arrays
- Perl Hashes (dictionary, associative array, look-up table)
- exists, delete hash elements
Regular Expressions
- Regular Expressions in Perl
- Regex: character classes
- Regex: quantifiers
- Regex: Greedy and non-greedy match
- Regex: Grouping and capturing
- Regex: Anchors
- Regex options and modifiers
- Substitutions (search and replace)
- trim - remove leading and trailing spaces
Perl and Shell related functionality
- Perl -X operators
- Perl pipes
- Running external programs
- Unix commands: rm, mv, chmod, chown, cd, mkdir, rmdir, ln, ls, cp
- How to remove, copy or rename a file with Perl
- Windows/DOS commands: del, ren, dir
- File globbing (Wildcards)
- Directory handles
- Traversing directory tree (find)
CPAN
- Download and install Perl (Strawberry Perl or manual compilation)
- Download and install Perl using Perlbrew
- Locating and evaluating CPAN modules
- Downloading and installing Perl Modules from CPAN
- How to change @INC to find Perl modules in non-standard locations?
- How to change @INC to a relative directory
- local::lib
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
- Web applications with Perl: PSGI
- Parsing XML files
- Reading and writing JSON files
- Database access using Perl (DBI, DBD::SQLite, MySQL, PostgreSQL, ODBC)
- Accessing LDAP using Perl
Other
- Splice to slice and dice arrays in Perl
- How to create a Perl Module for code reuse
- Object Oriented Perl using Mooses
- Attribute types in Perl classes when using Moose
Just a reminder, there are corresponding e-books and video courses available for purchase.