Basic Perl tutorial

The full Perl tutorial can be viewed by downloading the attached file.

Preface

To view the tutorial content, use one of the two command lines below:

./perl_course.pl --tutorial
 
perldoc ./perl_course.pl

To generate the example Perl scripts used in this tutorial either cut and paste then from
the perldoc and save them with an editor. A simpler way is to let this script generate
them for you. Create an empty directory and run this script with the ‘–create’ option.

./perl_course.pl --create

The script part of the perl_course.pl file will read itself and generate the example files
for you.

To get a printed copy of this tutorial pipe the output into a2ps

perldoc perl_course.pl | a2ps

On most systems the default for a2ps is to format two pages of output onto one page of
paper and print double sided.

Introduction

Perl is an acronym for Practical Extraction and Reporting Language. This is changed to
Pathological Eclectic Rubbish Lister by those that do not know the language.

Perl is a language to get the job done. It can be used for simple, single command line
operations similar to awk and sed. To full blown applications and suites of applications.
e.g. Apache web server, Postfix Mail server.

Something to remember: “There is always more than one way to do it with Perl!”

Hello World

No tutorial would be complete without a “Hello world!” example. Lets get it out of the
way.

============ intro-1.pl =================
#!/usr/bin/perl
use strict;
use warnings;
 
print "Hello World!\n";
=========================================

Download the full tutorial with the link below.
perl_course

Leave a Reply

Your email address will not be published. Required fields are marked *