Perl Tutorials - Herong's Tutorial Examples - v6.02, by Herong Yang
Perl Tutorials - Herong's Tutorial Examples
https://www.herongyang.com/Perl
© 1995-2024 Herong Yang. All rights reserved.
This Perl tutorial book is a collection of notes and sample codes written by the author while he was learning Perl language himself. Topics include introduction of ActivePerl; data types, variables and expressions; scalars, arrays, hash maps, and references; input/output and file systems; DBM files and MySQL access; socket communication; generating executables; XML::Simple and RPC:XML modules; LWP::UserAgent, HTTP::Request and SOAP::Lite modules; CGI, and IIS/Apache integrations. Updated in 2024 (Version v6.02) with minor updates.
Table of Contents
Perl Installation on Linux Systems
Running Perl Scripts on Linux Systems
Install ActivePerl on Windows Systems
Running Perl Scripts on Windows Systems
Data Types: Values and Variables
Variables - Scalar, Array and Hash
"undef" Value and Undefined Variables
Expressions, Operations and Simple Statements
Simple Statements and Modifiers
Declaring and Calling Subroutines
SubParamList.pl - Example on Parameter List
SubParamAlias.pl - Example on Parameters as Alias
SubReturnValue.pl - Example on Return Values
SubCalling.pl - Example on Calling Formats
Commonly Used Debugging Commands
Name Spaces and Perl Module Files
Including Script Codes from Other Files
do() Function - Including Script Files
require() Function - Including Script Files
"package" Statement - Switching Name Space
BEGIN(), CHECK(), INIT() and END() Functions
CalendarModule.pm - A Sample Perl Module
Hard References - Addresses of Memory Objects
Objects (or References) and Classes (or Packages)
Typeglob and Importing Identifiers from Other Packages
String Built-in Functions and Performance
String Related Built-in Functions
Performance of Perl substr() and index()
Performance of Java substring() and indexOf()
File Handles and Data Input/Output
open() - Opening File Handles for Input and Output
print() - Printing Output to File Handles
<file_handle> - Reading Data from File Handles
binmode() - Opening Files for Binary Input
binmode() - Opening Files for Binary Output
Copy.pl - Copying Binary Files
Bin2Hex.pl - Converting Binary Data to Hex Numbers
Open Directories and Read File Names
opendir() - Open Directory to Read File Names
opendir.pl - Sample Program to Read Directories
DirTree.pl - Displaying the Directory Tree
DirGrep.pl - Searching Text in Directory Files
File System Functions and Operations
Built-in Functions to Work with the File System
stat() - Returns File Statistics
Imager - Create and Save Image
Imager - Draw Graphical Elements
Imager - Convert Image File Format
Imager::File::PNG - PNG File Format
Install LIBPNG from Source Code
Install Imager::File::PNG Manually
Install PerlMagick from Source Code
dbmopen() - Opening DBM Files with Hash Variables
DBM Database Example - English French Dictionary
DBM Database Example - Book Records with Multiple Fields
Installing Database Module for MySQL
HelloMySQL.pl - My First Perl Program with MySQL
Socket Communication Over the Internet
connect() - Establishing a Socket Communication
ReverseEchoer.pl - A Simple Socket Server Program
SocketClient.pl - A Simple Socket Client Program
gethostbyaddr() - Network Utility Functions
XML::Simple Module - XML Parser and Generator
"forcearray" - Forcing Element Contents as Arrays
"suppressempty" - Parsing Empty Elements
"keyattr" - Namings Attributes as Keys
XmlSimpleHash.pl - XML Hash Example
XML Messages over Socket Connections
GameServer.pl - XML Communication Server Example
GameClient.pl - XML Communication Client Example
SOAP::Lite - SOAP Server-Client Communication Module
Perl Programs as IIS Server CGI Scripts
Configuring IIS 5.0 for Perl Programs
CGI (Common Gateway Interface)
What Is Common Gateway Interface (CGI)?
QUERY_STRING - CGI Query String
Calculator.pl - CGI Application Example
XML-RPC - Remote Procedure Call with XML and HTTP
Defining a Remote Method Call in XML
Sending a Remote Method Call as a HTTP Request
Defining Returning Values of a Remote Method Call
Receiving Returning Values as a HTTP Response
RPC::XML - Perl Implementation of XML-RPC
RPC::XML::Server - XML-RPC Server Interface Class
RPC::XML Client and Data Classes
RpcXmlServer.pl - RPC::XML Server Sample Program
RpcXmlClient.pl - RPC::XML Client Sample Program
Sending Arrays with Remote Method Calls
Integrating Perl with Apache Web Server
Downloading Apache HTTP Server 2.2.25 for Windows
Installing Apache HTTP Server 2.2.25 on Windows
Publishing HTML Documents as Web Pages
Starting and Stopping Apache Server
Running Perl Scripts in "cgi-bin"
printenv.pl - Testing Perl CGI Environment
cgi-lib.pl - The Standard Library for CGI Scripts
ReadParse() - Parsing Web Form Input Values
Running Perl Scripts in "htdocs"
CGI.pm Module for Building Web Pages
Generating HTML Document with CGI.pm
Retrieving Query Parameters and Headers
Retrieving Environment and Script Information
Retrieving and Setting HTTP Cookies
LWP::UserAgent and Web Site Testing
LWP-UserAgent-GET.pl - Sending a GET Request
LWP-UserAgent-GET-Redirect.pl - Following HTTP Redirects
http-equiv="Refresh" Meta Tag not Followed
LWP-UserAgent-POST.pl - Posting Form Data
post() Method not Following Redirect Location
LWP-UserAgent-POST-Redirect.pl - Posting with Redirects
LWP-UserAgent-Request.pl - GET, POST and Cookies
LWP-UserAgent-Request.pl - Login to facebook.com
HTTP::Cookies save() not Saving Temporary Cookies
LWP-UserAgent-Request-Cookies.pl - Sending Request with Cookies
Converting Perl Script to Executable Binary
Running PerlApp to Convert *.pl to *.exe
Managing Perl Engine and Modules on macOS
Perl Version Pre-Installed on macOS
Install Xcode Command Line Tools
Install Perl Module from Source Code
Archived: Install ActivePerl v5.18.1 on Windows Systems
Keywords: Perl, Script, Language, Tutorial, Example