Perl Tutorial - Practical Extraction and Reporting Language (Perl)

Please leave a remark at the bottom of each page with your useful suggestion.


Table of Contents

  1. Perl Introduction
  2. Perl Program Startup
  3. Perl Regular Expressions
  4. Perl Array Program
  5. Perl Basic Program
  6. Perl Subroutine / Function Program
  7. Perl XML Program
  8. Perl String Program
  9. Perl Statement Program
  10. Perl Network Program
  11. Perl Hash Program
  12. Perl File Handling Program
  13. Perl Data Type Program
  14. Perl Database Program
  15. Perl Class Program
  16. Perl CGI Program
  17. Perl GUI Program
  18. Perl Report Program

Perl Programming


Introduction

  • Practical Extraction and Reporting Language
  • Pathologically Eclectic Rubbish Lister
  • "Perl" is the language | "perl" is the compiler
  • Perl is a stable, cross platform programming language.
  • Perl was created by Larry Wall. (1987)
  • General purpose programming language, Free (open source), Fast, Flexible, Secure, Fun

It is assumed that the users understand the following general topics:

  • Perl data types (scalars, arrays, and hashes)
  • Conditional and looping constructs
  • Perl functions and operators
  • Basic regular expressions

Users may be currently working as system administrators using Perl for ad-hoc scripting and similar tasks, programmers in the early stages of migrating from other languages, or web developers looking to enhance their understanding of the world’s most popular CGI scripting language.

Blocks of code (nested inside braces) should be indented to make it easier to follow the flow of the program:

  • Space before the opening curly of a multi-line BLOCK.
  • One-line BLOCK may be put on one line, including curlies.
  • No space before the semicolon.
  • Space around most operators.
  • Space around a "complex" subscript (inside brackets).
  • Blank lines between chunks that do different things.
  • No space between function name and its opening parenthesis.
  • Space after each comma.
  • Long lines broken after an operator (except "and" and "or").

Typical Uses of Perl

  • Text processing (xml, html, etc)
  • System administration tasks
  • CGI and web programming
  • Database interaction
  • Other Internet programming
  • Human Genome Project
  • NASA

Perl Tutorial

  1. Perl ─ Data Types
    • Numeric Literals
    • String Literals
    • Variables
    • Scalars
    • Arrays
    • Hashes
  2. Perl ─ Contitional Statements
    • if statement
    • ifelse statement
    • ifelsifelse statement
    • unless statement
    • unlesselse statement
    • unlesselsif..else statement
    • switch statement
    • The ? : Operator
  3. Perl ─ Loops Statements
    • while loop
    • until loop
    • for loop
    • foreach loop
    • dowhile loop
    • nested loops
    • Loop Control Statements
    • next statement
    • last statement
    • continue statement
    • redo statement
    • goto statement
    • The Infinite Loop
  4. Perl ─ Operators
    • Perl Arithmetic Operators
    • Perl Equality Operators
    • Perl Assignment Operators
    • Perl Bitwise Operators
    • Perl Logical Operators
    • Quote-like Operators
    • Miscellaneous Operators
    • Perl Operators Precedence
  5. Perl ─ Date and Time
    • GMT Time
    • Format Date & Time
    • Epoch time
    • POSIX Function strftime()
  6. Perl ─ Subroutines
    • Define and Call a Subroutine
    • Passing Arguments to a Subroutine
    • Passing Lists to Subroutines
    • Passing Hashes to Subroutines
    • Returning Value from a Subroutine
    • Private Variables in a Subroutine
    • Temporary Values via local()
    • State Variables via state()
    • Subroutine Call Context
  7. Perl ─ File I/O
    • Opening and Closing Files
    • Open Function
    • Sysopen Function
    • Close Function
    • The <FILEHANDL> Operator
    • getc Function
    • read Function
    • print Function
    • Copying Files
    • Renaming a file
    • Deleting an Existing File
    • Positioning inside a File
    • File Information
  8. Perl ─ Directories
    • Display all the Files
    • Create new Directory
    • Remove a directory
    • Change a Directory
  9. Perl ─ Error Handling
    • The if statement
    • The unless Function
    • The ternary Operator
    • The warn Function
    • The die Function
    • Errors within Modules
    • The carp Function
    • The cluck Function
    • The croak Function
    • The confess Function
  10. Perl ─ Special Variables
    • Special Variable Types
    • Global Scalar Special Variables
    • Global Array Special Variables
    • Global Hash Special Variables
    • Global Special Filehandles
    • Global Special Constants
    • Regular Expression Special Variables
    • Filehandle Special Variables
  11. Perl ─ Regular Expressions
    • The Match Operator
    • Match Operator Modifiers
    • Matching Only Once
    • Regular Expression Variables
    • The Substitution Operator
    • Substitution Operator Modifiers
    • The Translation Operator
    • Translation Operator Modifiers
    • More Complex Regular Expressions
    • Matching Boundaries
    • Selecting Alternatives
    • Grouping Matching
    • The \G Assertion
    • Regular-expression Examples
  12. Perl ─ Sending Email
    • Using sendmail Utility
    • Using MIME::Lite Module
    • Using SMTP Server
  13. Perl ─ FTP Transaction
    • Using FTP Utility
    • Using Net::FTP Module
  14. Perl ─ Socket Programming
    • What is a Socket?
    • Server Side Socket Calls
    • Client Side Socket Calls
    • Client - Server Example
  15. Perl ─ OOP in Perl
    • Object Basics
    • Defining a Class
    • Creating and Using Objects
    • Defining Methods
    • Inheritance
    • Method Overriding
    • Default Autoloading
    • Destructors and Garbage Collection
    • Object Oriented Perl Example
  16. Perl ─ Database Access
    • Database Connection
    • INSERT Operation
    • READ Operation
    • UPDATE Operation
    • DELETE Operation
    • COMMIT Operation
    • ROLLBACK Operation
    • Begin Transaction
    • AutoCommit Option
    • Automatic Error Handling
    • Disconnecting Database
    • Some Other DBI Functions
    • Methods Common to All Handles
  17. Perl ─ CGI Programming
    • What is CGI ?
    • Web Browsing
    • CGI Architecture Diagram
    • Web Server Support and Configuration
    • First CGI Program..
    • Understanding HTTP Header
    • CGI Environment Variables
    • GET and POST Methods
    • Passing Information using GET Method
    • Simple URL Example : Get Method
    • Simple FORM Example: GET Method
    • Passing Information using POST Method
    • Passing Checkbox Data to CGI Program
    • Passing Radio Button Data to CGI Program
    • Passing Text Area Data to CGI Program.
    • Passing Drop Down Box Data to CGI Program
    • Using Cookies in CGI
    • CGI Modules and Libraries
  18. Perl ─ Packages and Modules
    • What are Packages?
    • BEGIN and END Blocks
    • What are Perl Modules?
    • The Require Function
    • The Use Function
    • Create the Perl Module Tree
    • Installing Perl Module



Write Your Comments or Suggestion...