Perl Core Language Little Black Book

by
Format: Paperback
Pub. Date: 1999-03-01
Publisher(s): Paraglyph Pr
Availability: This title is currently not available.
  • Free Shipping Icon

    This Item Qualifies for Free Shipping!*

    *Excludes marketplace orders.

List Price: $26.24

Rent Book

Select for Price
There was a problem. Please try again later.

New Book

We're Sorry
Sold Out

Used Book

We're Sorry
Sold Out

eBook

We're Sorry
Not Available

Summary

This book is one of the most practical and concise guides available for Perl programming. It includes step-by-step solutions on object-oriented programming in Perl. It provides highly referenceable, task-oriented answers to scripting with Perl.

Table of Contents

Introduction xxv
Part I Perl Syntax
Essential Perl
3(26)
In Brief
First Things First
4(2)
Immediate Solutions
Getting And Installing Perl
6(1)
Writing Perl Scripts
7(1)
Making Sure Your Script Can Find Perl
8(1)
Unix
8(1)
MS-DOS
9(1)
Windows 95/98 And Windows NT
10(1)
Macintosh
11(1)
Writing Perl Code: Statements And Declarations
11(1)
Running Perl Scripts
12(1)
If Your Script Can Find Perl
12(1)
If You Want To Use Perl From The Command Line
12(2)
Running Perl Scripts Interactively
14(2)
Using Command Line Switches
16(3)
Using The -w Switch For Warnings
19(1)
Handling Text Input And Output With Standard File Handles
19(1)
Displaying Text
20(1)
Displaying Line Numbers And Script File Names
21(1)
Printing Text A Number Of Times
21(1)
Basic Text Formatting
21(2)
Displaying Unformatted Text: Perl Here Documents
23(1)
Commenting Your Code
23(1)
Reading Typed Input
24(1)
Using The Default Variable $_
25(1)
Cleaning Up Typed Input
26(1)
Avoiding Immediate Script Closings In Windows 95/98 And NT
27(2)
Scalar Variables And Lists
29(26)
In Brief
Scalar Variables
31(1)
Lists
31(2)
Immediate Solutions
What's A Scalar Variable?
33(1)
Naming Scalar Variables
33(1)
Handling Scalar Assignments
34(1)
What's An Ivalue?
35(1)
Using Numbers In Scalar Variables
35(1)
Working With The Undefined Value: undef
36(1)
Declaring A Constant
36(1)
Handling Truth Values In Perl
37(1)
Converting Between Octal, Decimal, And Hexadecimal
38(1)
Hexadecimal To Decimal
38(1)
Decimal To Hexadecimal
38(1)
Octal To Decimal
38(1)
Decimal To Octal
38(1)
Rounding Numbers
39(1)
Using Strings In Scalar Variables
40(1)
Using String Interpolation
41(2)
Handling Difficult Interpolations
43(2)
Handling Quotes And Barewords
45(1)
What's A List?
46(1)
Referring To List Elements By Index
47(1)
Assigning Lists To Other Lists
48(1)
Mapping A List
49(1)
Joining A List Into A String
49(1)
Splitting A String Into A List
50(1)
Sorting Lists
50(2)
Reversing A List
52(1)
Selecting Elements From A List
52(1)
Understanding Scalar And List Contexts
53(1)
Forcing Scalar Context
53(2)
Arrays And Hashes
55(26)
In Brief
Arrays
56(1)
Hashes
56(1)
Typeglobs
57(1)
Immediate Solutions
Creating Arrays
58(1)
Using Arrays
59(1)
Pushing And Popping Arrays
60(1)
Shifting And Unshifting Arrays
61(1)
Finding The Length Of Arrays
62(1)
Growing Or Shrinking Arrays
63(1)
Merging Two Arrays
63(1)
Getting Array Slices
64(1)
Looping Over Arrays
64(2)
Printing Arrays
66(1)
Splicing Arrays
67(1)
Reversing Arrays
68(1)
Sorting Arrays
68(1)
Creating Hashes
69(2)
Using Hashes
71(1)
Adding Elements To Hashes
72(1)
Checking If Hash Elements Exist
73(1)
Deleting Hash Elements
73(1)
Looping Over Hashes
74(1)
Printing Hashes
75(1)
Sorting Hashes
76(1)
Merging Two Hashes
77(1)
Using Hashes And Arrays In List Assignments
77(1)
Using Typeglobs
78(2)
Comparing Typeglobs And Symbol Table Entries
80(1)
Operators And Precedence
81(24)
In Brief
Operator Precedence
83(2)
Immediate Solutions
Highest Precedence: Terms And Leftward List Operators
85(1)
Using The Arrow Operator
85(1)
Handling Autoincrement And Autodecrement
86(1)
Handling Exponentiation
87(1)
Using Symbolic Unary Operators
87(1)
Using Binding Operators
88(1)
Handling Multiplication And Division
89(1)
Handling Addition, Subtraction, And Concatenation
89(1)
Using The Shift Operators
90(1)
Using Named Unary Operators
90(1)
Working With File Test Operators
91(1)
Using Relational Operators
92(2)
Using Equality Operators
94(1)
Anding Bitwise Values
95(1)
Oring Bitwise Values
96(1)
Exclusive Oring Bitwise Values
96(1)
Using ``C-Style'' Logical And
97(1)
Using ``C-Style'' Logical Or
98(1)
Using The Range Operator
99(1)
Using The Conditional Operator
100(1)
Handling Assignments
101(1)
Using The Comma Operator
101(1)
Using Rightward List Operators
102(1)
Using Logical not
102(1)
Using Logical and
103(1)
Using Logical or
103(1)
Using Logical xor
103(2)
Conditionals And Loops
105(20)
In Brief
Conditional Statements
106(1)
Loop Statements
107(2)
Immediate Solutions
Using The if Statement
109(1)
Using The unless Statement
110(1)
Looping Over Elements With for
111(2)
Looping Over Elements With foreach
113(2)
Looping Over Elements With while
115(1)
Looping Over Elements With until
116(1)
Modifying Statements With if, unless, until, And while
117(1)
Creating A do while Loop
118(1)
Skipping To The Next Loop Iteration With next
118(1)
Ending A Loop With The last Command
119(1)
Redoing Iterations With The redo Loop Command
120(1)
Creating A switch Statement
121(1)
Using goto
122(1)
Executing Code With The eval Function
123(1)
Ending A Program With The exit Statement
123(1)
Using The die Statement
124(1)
Regular Expressions
125(24)
In Brief
Using Regular Expressions
126(3)
Immediate Solutions
Creating Regular Expressions
129(1)
Using Characters In Regular Expressions
130(1)
Matching Any Character
131(1)
Using Character Classes In Regular Expressions
132(1)
Using Alternative Match Patterns In Regular Expressions
133(1)
Using Quantifiers In Regular Expressions
133(1)
Quantifier ``Greediness''
134(1)
Using Assertions In Regular Expressions
135(1)
Using Regular Expression Backreferences To Refer To Previous Matches
136(1)
Using Regular Expression Extensions
137(1)
Using Modifiers With m// And s///
138(1)
Translating Strings With tr///
138(1)
Using Modifiers With tr///
139(1)
Matching Words
140(1)
Matching The Beginning Of A Line
141(1)
Matching The End Of A Line
141(1)
Checking For Numbers
141(1)
Checking For Letters
142(1)
Finding Multiple Matches
143(1)
Using Case-Insensitive Matching
144(1)
Extracting A Substring
144(1)
Using Function Calls And Perl Expressions In Regular Expressions
145(1)
Finding The nth Match
145(1)
Making Quantifiers Less Greedy
146(1)
Removing Leading And Trailing White Space
147(1)
Using Assertions To Look Ahead And Behind
147(2)
Subroutines
149(22)
In Brief
Working With Subroutines
150(2)
Immediate Solutions
Declaring Subroutines
152(1)
Using Prototypes
153(1)
Defining Subroutines
154(1)
Calling Subroutines
154(1)
Reading Arguments Passed To Subroutines
155(1)
Using A Variable Number Of Arguments
156(1)
Using Default Argument Values
157(1)
Returning Values From Subroutines (Functions)
158(1)
Setting Scope With my
159(2)
Requiring Lexically Scoped Variables
161(1)
Creating Temporary Variables With local
161(1)
Persistent (Static) Variables
162(2)
Calling Subroutines Recursively
164(1)
Nesting Subroutines
164(1)
Passing By Reference
165(1)
Passing Symbol Table Entries (Typeglobs)
166(1)
Checking Return Context With wantarray
167(1)
Creating Inline Functions
168(1)
Overriding Built-In Functions And Using CORE
168(1)
Creating Anonymous Subroutines
169(1)
Creating Subroutine Dispatch Tables
169(2)
Perl References
171(22)
In Brief
Hard References
172(1)
Symbolic References
173(1)
The Arrow Operator
174(1)
Anonymous Arrays, Hashes, And Subroutines
174(1)
Immediate Solutions
Creating A Reference
175(2)
Creating References To Anonymous Arrays
177(1)
Creating References To Anonymous Hashes
178(1)
Creating References To Anonymous Subroutines
178(1)
Getting References Using The Symbol Table
179(1)
Dereferencing References
180(2)
Dereferencing With The Arrow Operator
182(2)
Omitting The Arrow Operator
184(1)
Determining The Type Of A Reference With The ref Operator
184(1)
Creating Symbolic References
185(1)
Disallowing Symbolic References
186(1)
Using Array References As Hash References
187(1)
Creating Persistent Scope Closures In Perl
187(1)
Creating Functions From Function Templates
188(5)
Part II Built-In Resources
Built-In Variables
193(22)
In Brief
English Versions Of The Built-In Variables
195(2)
Setting The Built-In Variables For Specific File Handles
197(2)
Immediate Solutions
$' Postmatch String
199(1)
$- Number Of Lines Left On The Page
199(1)
$! Current Error
199(1)
$`` Output Field Separator For Interpolated Array Values
200(1)
$# Output Format For Printed Numbers
200(1)
$$ Perl Process Number
200(1)
$% Current Output Page
200(1)
$& Last Match
201(1)
$( Real GID
201(1)
$) Effective GID
201(1)
$* Multiline Matching
201(1)
$, Output Field Separator
202(1)
$. Current Input Line Number
202(1)
$/ Input Record Separator
202(1)
$: String Break Characters
203(1)
$; Subscript Separator
203(1)
$? Status Of Last Pipe Close, Backtick Command, Or System Call
204(1)
$@ Error From Last eval
204(1)
$[ Array Base
204(1)
$\ Output Record Separator
204(1)
$] Perl Version
204(1)
$^ Current Top-Of-Page Format
205(1)
$^A Write Accumulator
205(1)
$^D Current Debugging Flags
205(1)
$^E OS-Specific Error Information
205(1)
$^F Maximum System File Descriptor
206(1)
$^H Current Syntax Checks
206(1)
$^I Current Inplace-Edit Value
206(1)
$^L Output Form Feed
206(1)
$^M Emergency Memory Buffer
206(1)
$^O Operating System Name
207(1)
$^P Debugging Support
207(1)
$^R Result Of Last Regular Expression Assertion
207(1)
$^S State Of The Interpreter
208(1)
$^T Time At Which Script Began Running
208(1)
$^W Current Value Of The Warning Switch
208(1)
$^X Executable Name
208(1)
$_ Default Variable
209(1)
$` Prematch String
209(1)
$I Output Autoflush
209(1)
$~ Name Of The Current Report Format
210(1)
$+ Last Parentheses Match
210(1)
$< Real UID
210(1)
$= Current Page Length
211(1)
$> Effective UID
211(1)
$O Program Name
211(1)
$ARGV Name Of Current File
211(1)
$n Pattern Match n
212(1)
%ENV Environment Values
212(1)
%INC Included Files
212(1)
%SIG Signal Handlers
213(1)
@_ Subroutine Arguments
213(1)
@ARGV Command Line Arguments
213(1)
@INC Location Of Scripts To Evaluate
214(1)
Built-In Functions: Data Processing
215(24)
In Brief
Built-In Functions
217(1)
Immediate Solutions
abs Absolute Value
218(1)
atan2 Arctangent
218(1)
chomp Remove Line Endings
218(1)
chop Remove Last Character
219(1)
chr Character From Code
219(1)
cos Cosine
220(1)
each Hash Key And Value Pairs
220(1)
eval Evaluate Perl Code
221(1)
exists Check Hash Key
221(1)
exp Raise To The Power Of e
221(1)
hex Convert From Hexadecimal
222(1)
index Position Of Substring
222(1)
int Truncate To Integer
222(1)
join Join List Into A String
223(1)
keys Hash Keys
223(1)
lc Lowercase
224(1)
lcfirst Lowercase First Character
224(1)
length String Length
224(1)
log Natural Logarithm
225(1)
map Evaluate Code For Each Element
225(1)
oct Convert From Octal
225(1)
ord ASCII Value
226(1)
pack Pack Values
226(1)
pop Pop Array Value
227(1)
POSIX Functions
228(1)
push Push Array Value
228(1)
rand Random Number
229(1)
reverse Reverse List
229(1)
rindex Reverse Index
229(1)
scalar Force Scalar Context
230(1)
shift Shift Value From Array
230(1)
sin Sine
230(1)
sort Sort List
231(1)
splice Replace Subarray Elements
232(1)
split Split A String Into An Array Of Strings
232(1)
sprintf Format String
233(1)
sqrt Square Root
234(1)
srand Set Random Number Seed
235(1)
substr Substring
235(1)
time Seconds Since January 1, 1970
236(1)
uc Uppercase
236(1)
ucfirst Uppercase First Character
236(1)
unpack Unpack Values
237(1)
unshift Shift Values Onto Array
237(1)
values Hash Values
238(1)
vec Vector Of Unsigned Integers
238(1)
Built-In Functions: I/O And Interprocess Communication
239(22)
In Brief
Perl Formats
240(2)
Immediate Solutions
print Print List Data
242(1)
printf Print Formatted List Data
243(1)
Reading Input With <>
244(1)
getc Get A Character
244(1)
write Write A Formatted Record
245(1)
Formats: Left-Justifying Text
245(1)
Formats: Right-Justifying Text
246(1)
Formats: Centering Text
246(1)
Formats: Printing Numbers
246(1)
Formats: Formatted Multiline Output
247(1)
Formats: Formatted Multiline Output With Text Slices
247(1)
Formats: Unformatted Multiline Output
248(1)
Formats: Top-Of-Form Output
248(1)
Formats: Using Format Variables
249(1)
warn Display A Warning
250(1)
IPC: exec Executing A System Call
251(1)
IPC: system Forking And Running A System Command
251(1)
IPC: Reading Data From Another Program
252(1)
IPC: Sending Data To Another Program
253(1)
IPC: Writing To A Child Process
253(1)
IPC: Writing To A Parent Process
254(1)
IPC: Sending A Signal To Another Process
255(2)
IPC: Using Sockets
257(1)
IPC: Win32 OLE Automation
258(3)
Built-In Functions: File Handling
261(26)
In Brief
All About File Handling
263(2)
Immediate Solutions
open Open A File
265(1)
close Close A File
266(1)
print Print To A File
267(1)
write Write To A File
268(1)
binmode Set Binary Mode
268(1)
Setting Output Channel Buffering
269(1)
Reading Files Passed From The Command Line
270(1)
Reading From A File Handle
270(1)
read Read Input
271(1)
readline Read A Line Of Data
271(1)
getc Get A Character
272(1)
seek Set The Current Position In A File
272(1)
tell Get The Current Position In A File
273(1)
stat File Status
274(1)
POSIX File Functions
275(1)
select Setting The Default Output File Handle
276(1)
eof Test For End Of File
276(1)
Writing A DBM Database File
277(1)
Reading A DBM Database File
278(1)
flock Lock File
279(1)
chmod Change File Permission
279(1)
glob Get Matching Files
280(1)
rename Rename A File
280(1)
unlink Delete Files
281(1)
opendir Open A Directory
281(1)
closedir Close A Directory
281(1)
readdir Read Directory Entry
282(1)
seekdir Set Current Position In A Directory
282(1)
telldir Directory Position
282(1)
rewinddir Set Directory Position To Beginning
282(1)
chdir Change Working Directory
283(1)
mkdir Make A Directory
283(1)
rmdir Remove A Directory
284(3)
Part III Perl Programming
Built-In Modules
287(20)
In Brief
Using Perl Modules
288(6)
Immediate Solutions
Term::Cap Work With The Terminal
294(1)
Math: Complex And Big Numbers
295(1)
POSIX: Portable Operating System Interface
295(1)
Benchmark: Benchmark Tests
296(1)
Time: Times And Time Conversions
297(1)
Carp: Report Errors From Caller's Perspective
297(1)
locale: Enable Locale-Sensitive Operations
297(1)
File: File Operations
298(1)
Net: Internet Access
298(1)
Safe: Safe Code Compartments
299(1)
Tk: The Tk Toolkit
299(1)
Tk: Button And Text Widgets
300(1)
Tk: Radiobutton And Checkbutton Widgets
300(1)
Tk: Listbox Widgets
301(1)
Tk: Scale Widgets
302(1)
Tk: Canvas Widgets
303(1)
Tk: Menu Widgets
303(1)
Tk: Dialog Box Widgets
304(3)
Data Structures
307(20)
In Brief
A Good Idea: use strict vars
311(2)
Immediate Solutions
Complex Records: Storing References And Other Elements
313(1)
Declaring Arrays Of Arrays
314(1)
Creating Arrays Of Arrays On The Fly
314(2)
Accessing Arrays Of Arrays
316(1)
Declaring Hashes Of Hashes
317(1)
Creating Hashes Of Hashes On The Fly
318(1)
Accessing Hashes Of Hashes
319(1)
Declaring Arrays Of Hashes
320(1)
Creating Arrays Of Hashes On The Fly
320(1)
Accessing Arrays Of Hashes
321(2)
Declaring Hashes Of Arrays
323(1)
Creating Hashes Of Arrays On The Fly
323(1)
Accessing Hashes Of Arrays
324(1)
Linked Lists And Ring Buffers
324(3)
Creating Packages And Modules
327(18)
In Brief
Packages
328(2)
Modules
330(1)
Immediate Solutions
Creating A Package
331(1)
Creating A Package Constructor: BEGIN
332(1)
Creating A Package Destructor: END
333(1)
Determining The Current Package
334(1)
Splitting A Package Across File Boundaries
334(1)
Creating Modules
335(1)
Exporting Symbols From Modules By Default
336(1)
OKing Symbols To Export From Modules
337(1)
Preventing Symbol Importation
337(1)
Preventing Symbol Exportation
338(1)
Exporting Without The import Method
339(1)
Creating Nested Submodules
340(1)
Checking Module Version Numbers
341(1)
Autoloading Subroutines In Modules
342(1)
Using AutoLoader And SelfLoader
343(2)
Creating Classes And Objects
345(22)
In Brief
Classes
346(1)
Objects
347(1)
Methods
348(1)
Inheritance
349(1)
Immediate Solutions
Creating A Class
350(1)
Creating A Constructor
350(1)
Creating An Object
351(1)
Creating A Class Method
351(1)
Creating An Instance Method
352(1)
Invoking A Method
352(1)
Creating An Instance Variable
353(1)
Creating Private Methods And Variables
354(1)
Creating A Class Variable
355(1)
Creating A Destructor
356(1)
Implementing Class Inheritance
357(1)
Inheriting Constructors
358(1)
Inheriting Instance Variables
359(1)
Multiple Inheritance
360(1)
Overriding Base Class Methods
361(1)
Tying Scalars
362(1)
Tying Arrays
363(1)
Tying Hashes
364(1)
Using The Perl UNIVERSAL Class
365(2)
Perl Debugging And Style Guide
367(20)
In Brief
A Sample Debugging Session
368(3)
Immediate Solutions
Trapping Runtime Errors
371(1)
Starting The Debugger
372(1)
What Debugger Commands Are Available
373(3)
Listing Your Code
376(1)
Single Stepping
377(1)
Single Stepping Over Subroutine Calls
377(1)
Setting Breakpoints
378(1)
Deleting Breakpoints
379(1)
Continuing To Breakpoint
379(1)
Printing An Expression
379(1)
Evaluating An Expression
380(1)
Changing Values In Variables
380(1)
Setting Global Watches
380(1)
Setting Debugger Actions
381(1)
Quitting The Debugger
381(1)
Perl Style Guide
382(5)
Part IV CGI Programming
CGI Programming
387(22)
In Brief
Using CGI.pm
388(2)
Creating And Using HTML Controls
390(7)
Immediate Solutions
Using PerlScript
397(1)
Starting An HTML Document In CGI
398(1)
Creating HTML Heads
398(1)
Centering HTML Elements
399(1)
Creating A Bulleted List
399(1)
Creating A Hyperlink
400(1)
Creating Horizontal Rules
400(1)
Creating An HTML Form
400(1)
Working With Text Fields
401(1)
Reading Data From HTML Controls
401(1)
Working With Text Areas
402(1)
Working With Checkboxes
403(1)
Working With Scrolling Lists
403(1)
Working With Radio Buttons
404(1)
Working With Pop-Up Menus
405(1)
Working With Hidden Data Fields
406(1)
Creating Submit And Reset Buttons
406(1)
Ending An HTML Form
407(1)
Ending An HTML Document
407(1)
Function-Based CGI Programming
407(2)
CGI Programming With cgi-lib.pl
409(20)
In Brief
Using cgi-lib.pl
412(5)
Immediate Solutions
What Subroutines Does cgi-lib.pl Include?
417(1)
Starting An HTML Document
418(1)
Creating HTML Heads
419(1)
Centering HTML Elements
419(1)
Creating A Bulleted List
419(1)
Creating A Hyperlink
420(1)
Creating Horizontal Rules
420(1)
Creating An HTML Form
420(1)
Working With Text Fields
421(1)
Reading Data From HTML Controls
421(1)
Working With Text Areas
422(1)
Working With Checkboxes
422(1)
Working With Scrolling Lists
423(1)
Working With Radio Buttons
424(1)
Working With Pop-Up Menus
424(1)
Working With Hidden Data Fields
425(1)
Creating Submit And Reset Buttons
425(1)
Ending An HTML Form
426(1)
Ending An HTML Document
426(1)
Displaying All Variables
426(3)
CGI: Web Counters, Guest Books, Emailers, And Secure Scripts
429(20)
In Brief
CGI Security
430(2)
Immediate Solutions
Taking Security Seriously
432(1)
Working With Tainted Data
433(2)
Untainting Data
435(1)
Giving A CGI Script More Privileges In Unix
436(1)
Creating A Web Counter
436(2)
Creating A Guest Book
438(6)
Emailing From A CGI Script
444(5)
CGI: Multiuser Chat, Cookies, And Games
449(22)
In Brief
Chat Applications
450(1)
Cookies
450(1)
A Game
451(1)
Immediate Solutions
Creating A Multiuser Chat Application
452(1)
Multiuser Security Issues
452(1)
Handling Denial Of Service Attacks
453(1)
Chatting From A Web Browser
454(1)
Setting An HTML Page's Refresh Rate
454(1)
Clearing Refreshed HTML Controls
454(5)
Writing And Reading Cookies
459(4)
Using Cookies
459(2)
How To Write A Cookie
461(1)
How To Read A Cookie
461(2)
Creating A Game
463(8)
Storing Data In Web Pages Between Calls To A Script
464(1)
Customizing This Game
464(7)
Index 471

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.