Practical Perl Programming
View
19
Download
0
Category
Documents
Report
Preview:
Click to see full reader
Citation preview
Page 1
Practical Perl Programming
Contents
Introduction to Perl
What is Perl?
Origins
Similar to C?
Cost and Licensing
Installing Perl Installed
Getting and Installing Perl
Writing Perl Programs
Creating the Program
Invocation
Comments in Your Program
Further Reading/Information
Numeric and String Literals
Numeric Literals
Example: Numbers
String Literals
Example: Single-Quoted Strings
Example: Double-Quoted Strings
Example: Back-Quoted Strings
Variables
Scalar Variables
Defining Scalar Variables
String Scalar Variables
Arrays
What is an Array?
Literal Arrays
Indexed Arrays
Some Useful Array Functions
Associative Arrays
Associative Array Operators
Operators
The Binary Arithmetic Operators
The Unary Arithmetic Operators
The Logical Operators
The Bitwise Operators
Comparison operators for numbers and strings
The Range Operator (..)
The String Operators (. and x)
Order of Precedence
Perl Statements
Understanding Expressions
Statement Blocks
Statement Blocks and Local Variables
If/Unless statement
The for statement
The while/until statement
The foreach statement
Functions
Using the Parameter Array (@_)
Passing Parameters by Reference
Scope of Variables
Using a List as a Function Parameter
Nesting Function Calls
Using a Private Function
String Functions
Array Functions
Summary
References
Reference Types
Passing Parameters to Functions
The ref() Function
Example: Creating a Data Record
Interpolating Functions Inside Double-Quoted Strings
Summary
Files -- Input and Output in Perl
Some Files Are Standard
Using the Diamond Operator (<>)
File Test Operators
File Functions
Reading Directories
Reading and Writing Files
Binary Files
Getting File Statistics
Printing Revisited
Regular Expressions
What are regular Expressions
Using Regular Expressions
Special pattern matching character operators
Backtracking
Setting the Target Operator (Binding)
Substitution
The Matching Operator (m//)
The Matching Options
The Translation Operator (tr///)
The Translation Options
The Binding Operators
Character Classes
Quantifiers
Pattern Memory
Pattern Precedence
Extension Syntax
Pattern Examples
Some Practical Examples
Using the Match Operator
Using the Substitution Operator
Example: Using the Translation Operator
Example: Using the Split() Function
Reports
Format Statements
Field Lines
Report Headings
Special Variables
What Are the Special Variables?
Example: Using the DATA File Handle
Example: Using the %ENV Variable
Handling Errors and Signals
Checking for Errors
Using errno
Using the || Logical Operator
Using the die() Function
Using the warn() Function
Trapping Fatal Errors
Using the eval() Function
Signals
How to Handle a Signal
Objects in Perl
What are objects?
Classes
Abtraction
Polymorphism:Overriding Methods
Encapsulation:Keeping Code and Data Together
Objects in Perl
Bless the Hash and Pass the Reference
Initializing Properties
Using Named Parameters in Constructors
Inheritance: Perl Style
Polymorphism
One Class Can Contain Another
Static Versus Regular Methods and Variables
Perl Modules
Module Constructors and Destructors
The BEGIN Block
The END Block
Symbol Tables
The use Compiler Directive
Pragma in Perl
The strict Pragma
The Standard Modules
strict, my() and Modules
Module Examples
The Carp Module
The English Module
The Env Module
Debugging Perl
Syntax Errors
Common Syntax Errors
Logic Errors
Using the -w Command-Line Option
Being Strict with Your Variables
Stepping Through Your Script
Displaying Information
Examples: Using the n Command
Using Breakpoints
Creating Command Aliases
Using the Debugger as an Interactive Interpreter
Summary
Perl Command-Line Options
How Are the Options Specified?
The Command-line Options
Example uses of command-line options
Using the -0 Option
Using the -n and -p Options
Using the -i Option
Using the -s Option
Summary
Networking with Perl
Sockets
Clients and Servers
The Server Side of a Conversation
The Client Side of a Conversation
Using the Time Service
Sending Mail (SMTP)
The MAIL Command
The RCPT Command
The DATA Command
Reporting Undeliverable Mail
Using Perl to Send Mail
Receiving Mail (POP)
Checking for Upness (Echo)
Transferring Files (FTP)
The World Wide Web (HTTP)
CGI Programming in Perl
CGI Scripting
What is a CGI Script?
Writing and Running CGI Scripts
Why Use Perl for CGI?
CGI Apps versus Java Applets
Should You Use CGI Modules?
How Does CGI Work?
Calling Your CGI Program
Beginning CGI Programming in Perl
CGI Script Output
A First Perl CGI Script
Exectiion of CGI Programs
Why Are File Permissions Important in UNIX?
HTTP Headers
CGI and Environment Variables
URL Encoding
Security
CGIwrap and Security
The Other Side of CGI:Input -- HTML Forms
A Brief Overview of HTML
Server-Side Includes
Forms: Facilitating User Input and Interaction
Forms and CGI: What are they?
Some Example Forms
The FORM Tag
Entering Data
The Submit Button
Text Input
Password
Associating labels with text and password input
Radio Buttons
Checkboxes
Assigning Initial Input Values to
Select
Textarea
Hidden Input
An Example Form
HTML Forms as an Interface to Databases
Further Information
CGI Script Input: Accepting Input To Perl Scripts
Accepting Input from the Browser
Passing Data to a CGI Script
A Simple Form CGI Script Call
The Other Side -- receiving and processing information in CGI ( Perl) script
cgi-lib.pl
The cgi.pm module
A Minimal Form Response CGI Perl Script
Multiple argument input to a Perl CGI script
Some Example Perl CGI Scripts
RGBtoHex: an RGB to Hexidecimal Color Converter
An Address Book Search Engine
Creating a Guest Book
A Web Page Counter
Using Perl with Web Servers
Server Log Files
Reading a Log File In Perl
Listing Access by Document
Looking at the Status Code
Existing Log File Analyzing Programs
Creating Your Own CGI Log File
Internet Resources
Web Sites
A Quick Quide to HTML
Basic HTML Programming
HTML
Hypertext Terminology
Creating HTML Documents
Learning HTML
Anatomy of Any HTML Document
HTML Tags
Basic HTML Page Structure
Summary of Basic HTML Tags
Bare-bones example of HTML
Basic HTML Coding
Head elements
The Body Element
Headings
Paragraphs
Comments
Links and Anchors
Linking to Other Documents
Relative, Absolute and remote Links
Anchors
Lists
Unordered or Bulleted lists
Ordered or Numbered lists
Glossary or Definition Lists
Nesting Lists
Preformatted Text
In-Line Images
External Images, Sounds, Video
Things to remember when HTML programming
Text Formatting with HTML
Logical Character Formatting
Physical Character formatting
Special Characters
Horizontal rules and Line breaks
Fonts and Font Sizes
Recommended Reading
About this document ...
OOFKHBDGEFBFPAEMKAHPKJMKLEJBGHKP:
form1:
f1:
x:
f2:
form2:
x:
f1:
f2:
f3: [chartreuse]
f4: african
f5:
f6:
EIBGHFPNGKNOCHJMFLNGGKHDLLGGCMCF:
form1:
f1:
form2:
f1:
form3:
x:
f1: left
f3: right
f5: up
f7: down
f2:
f4:
f6:
f8:
JEELDDPJJFDEJHGNBDJHLOAMBJLMOEGO:
form1:
x:
f1:
form2:
x:
f1:
FOHGCHGLMLDBOPPOOKBOCCGLIDPNJIGK:
form1:
x:
f1:
HPCBKGFBDIGILOHPCCLGLNKGJBDCGOBN:
form1:
x:
f1:
f2:
GFNBHGPNIACDADFAEENGLHHLEGKADDGE:
form1:
x:
f1: Off
EDPDBJBNPKPBKCPLAJFPEAGCLMJCMKNE:
form1:
x:
f1: Off
f2: Off
f3: Off
f4: Off
f5: Off
f6: Off
JOAEOFHNDOAPNJLDMCGAFDDFJFFIEEBG:
form1:
x:
f1: Y
BLDFMEDBGBOBCCAJJLDFJNGKFHAPKEEM:
form1:
x:
f1: [ Europe]
KDNHDDGFJCKMADLADHNILFJPLIABGHIF:
form1:
x:
f1:
form2:
x:
f1: Please type here...
FACEIPJNOOKDBHIPOPJCMOKAMAEGPJLL:
form1:
f1:
x:
f2:
EPACCLHIFLEDAPIFKEBJIGKJOEBGKFLP:
form1:
x:
f1:
f2:
f3: [chartreuse]
f4: african
f5:
f6:
OCIEDKOBKJMPNBIPBIJCCNCHCMGLCIBJ:
form1:
x:
f1:
f2:
f3:
f4:
f5:
PDDJOPHBNGAEODDIFNKBIKBFBGKHFALK:
form1:
x:
f1:
f2:
f3:
f4:
f5:
f6:
f7:
f8:
GIIJGOOGFFPKKNKAPFDBAEKFHBCHAKGJ:
form1:
x:
f1:
f2:
f3:
f4:
f5:
Recommended
Perl Programming - 04 Programming Database
Software
Introduction To Perl Dulal C. Kar. Perl Perl: Practical extraction and Reporting Language General purpose programming language Downloads available from:
Documents
Perl 101 - The Basics of Perl Programming
Education
Programming Perl - Perl Training · This is version 1.39 of Perl Training Australia’s "Programming Perl" training manual. Table of Contents 1. About Perl Training Australia
Documents
PERL Programming Basic
Documents
Effective Perl Programming - pearsoncmg.comptgmedia.pearsoncmg.com/images/9780321496942/samplepages/... · Effective Perl Programming Ways to Write Better, More Idiomatic Perl Second
Documents
Unix Programming with Perl
Technology
Introduction to perl programming
Documents
Introduction to Perl Programming
Documents
Shell Script & Perl Programming
Documents
Programming Perl DBI.pdf
Documents
Intermediate Perl · Related titles Learning Perl Programming Perl Advanced Perl Programming ... that spark revolutionaryindustries. We specialize in docu-menting the latest tools
Documents
Perl Programming - 03 Programming File
Software
Perl programming session 5 operators in perl
Education
Database Programming with Perl - Perl Training Australiaperltraining.com.au/notes/perldbi.pdf · · 2008-06-16Exercises ... Welcome to Perl Training Australia’s Database Programming
Documents
Network Programming With Perl
Documents
Perl x86 JIT Programming
Technology
Basic Perl Programming
Documents
Basic Perl CGI Programming
Documents
Web Browsing Web Server Support & Configurationggnindia.dronacharya.info/IT/Downloads/SubInfo/6... · Perl is a stable, cross platform programming language. Perl stands for Practical
Documents