Perl 5 Interactive Course
(Publisher: Macmillan Computer Publishing)
Author(s): JON ORWANT
ISBN: 1571690646
Publication Date: 08/30/96
- Introduction
- Preface
- About the Author
- CHAPTER 1MEET PERL: THE BASICS
- Session 1The Look and Feel of Perl
- Running a Perl Program
- Command-Line Flags
- Is Perl Compiled or Interpreted?
- Quiz 1
- Exercise 1
- Session 2Scalars
- Double Quotes and Single Quotes
- Functions
- The chomp() and chop() Functions
- Operators
- Quiz 2
- Exercise 2
- Session 3The if Statement and Expressions
- Expressions
- Backslashed Characters
- if...else Statements
- Assignment Operators
- Exponentiation
- Precedence
- Autoincrement and Autodecrement
- The ?: Operator
- The ! Operator
- Quiz 3
- Exercise 3
- Session 4Introduction to Loops
- Beware Infinite Loops!
- The % Operator
- The int() Function
- Rounding Numbers
- Integer Arithmetic
- Quiz 4
- Exercise 4
- Review
- Session 5Arrays
- The foreach Loop
- Array Indexing
- A Few Words About Initial Characters
- Out of Bounds!
- The Last Index of an Array
- The $[ Special Variable
- Negative Array Indexes
- Adding and Removing Array Elements
- push() and pop()
- unshift() and shift()
- splice()
- Quiz 5
- Exercise 5
- Session 6Advanced Loops
- The for Loop
- Loop Control: next, last, andredo
- Ssssshhhhh!
- Quiz 6
- Exercise 6
- Session 7The Default Variable $_
- @ARGV
- Quiz 7
- Exercise 7
- Session 8Contexts
- The scalar() Function
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Difficult
- CHAPTER 2PATTERN MATCHING: REGULAR EXPRESSIONS
- Session 1Regular Expressions
- Making Substitutions
- Alternatives
- The -n and -p Command-Line Flags
- Quiz 1
- Exercise 1
- Session 2Metacharacters And Special Characters
- Kleene Plus: +
- Kleene Star: *
- Curly Braces
- Question Marks
- The . Special Character
- Quiz 2
- Exercise 2
- Session 3Matching
- Parentheses
- QUIZ 3
- Exercise 3
- Session 4Translations
- Quiz 4
- Exercise 4
- Review
- Session 5Pattern Anchors and Some More Special Variables
- Quiz 5
- Exercise 5
- Session 6Advanced regexes I and grep()
- Ranges
- grep()
- Quiz 6
- Exercise 6
- Session 7map() and Advanced Regexes II
- map()
- Greediness
- Uncluttering regexes
- Quiz 7
- Exercise 7
- Session 8Advanced regexes III
- Regexp Extensions
- study()
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Moderate
- Medium
- Hard
- CHAPTER 3THE OUTSIDE WORLD: FILES AND FILEHANDLES
- Session 1Introduction to I/O
- Filehandles
- Standard Filehandles
- Reading from a File
- Exiting a Program
- Logical Operators
- The $! Special Variable
- Writing to a File
- In-Place Editing
- Quiz 1
- Exercise 1
- Session 2Reading and Writing
- Moving Around in a File
- Shortening Files
- Quiz 2
- Exercise 2
- Session 3External Programs and Pipes
- Backquotes
- system()
- Executing Another Perl Program
- Piping Data to and from a Program
- Pipe Errors
- Deleting Files
- Quiz 3
- Exercise 3
- Session 4Interacting with UNIX
- Links
- File Locking
- UNIX Permissions
- utime()
- Quiz 4
- Exercise 4
- Review
- Session 5Using Internet Applications
- Generating E-Mail from Your Perl Programs
- Filtering Incoming E-Mail
- Using an Internet Service
- Quiz 5
- Exercise 5
- Session 6Inspecting Files
- _, stat(), and file tests
- Quiz 6
- Exercise 6
- Session 7File Bits and Bytes
- Testing for End of File
- Reading Bytes Instead of Lines
- Buffering
- Quiz 7
- Exercise 7
- Session 8Accessing Directories
- Accessing Directories
- Making (and Unmaking) Directories
- Changing Directories
- Globbing
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 4DIVIDE AND CONQUER: SUBROUTINES
- Session 1Introduction To Subroutines
- Invoking Subroutines
- Subroutine Output
- Quiz 1
- Exercise 1
- Session 2Argument Passing And Some Math
- A Bit of Math: sqrt() and abs()
- Exponential Notation
- Quiz 2
- Exercise 2
- Session 3Recursion And More Math
- Recursion
- sin(), cos(), and atan2()
- exp() and log()
- Quiz 3
- Exercise 3
- Session 4Scoping
- Quiz 4
- Exercise 4
- Review
- Session 5Blocks
- Labels
- goto
- do()
until()
- Continue Blocks
- reset()
- ??
- Quiz 5
- Exercise 5
- Session 6Organizing Arrays And Autoloading Functions
- Sorting
- The <=> and cmp Operators
- Joining Arrays and Splitting Strings
- Array Interpolation
- Reversing Variables
- Autoloading
- Quiz 6
- Exercise 6
- Section 7Arrays And Subroutines
- Passing Multiple Arrays into a Subroutine
- Passing References
- Passing Globs
- Modifying Subroutine Arguments
- Passing a Filehandle into a Subroutine
- wantarray()
- Quiz 7
- Exercise 7
- Session 8Bits and Bases
- chr(), ord(), oct(), and hex()
- Bitwise Operators
- vec()
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 5MINCING WORDS: HASHES
- Session 1Whats a Hash?
- Quiz 1
- Exercise 1
- Session 2Manipulating Keys and Values
- Retrieving Keys or Values
- Retrieving Keys and Values
- Deleting Key-Value Pairs
- Quiz 2
- Exercise 2
- Session 3Randomness and Time
- Choosing a Random Number
- Time
- Quiz 3
- Exercise 3
- Session 4%Env and Sleeping
- Sleeping
- Quiz 4
- Exercise 4
- Review
- Session 5Existence
- Quiz 5
- Exercise 5
- Session 6Data Structures
- User-Defined Data Types
- Anonymous Variables
- Multielement Keys
- The Perl Data Structures Cookbook
- Quiz 6
- Exercise 6
- Session 7Hash Leftovers
- Hash Storage Efficiency
- Hashes as Subroutine Arguments
- Symbol Tables
- Sorting a Hash
- Quiz 7
- Exercise 7
- Session 8Quoting Operators and Barewords
- q, qq, and qx
- qw()
- quotemeta()
- Barewords
- Quiz 8
- Exercise 8
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- Review
- CHAPTER 6LOOKS ARE EVERYTHING: FORMATS
- Session 1Introduction To Formats
- Declaring Formats
- Naming Formats
- Formatting Without Formats
- Quiz 1
- Exercise 1
- Session 2Picture Fields
- Aligning Variables
- Quiz 2
- Exercise 2
- Session 3Pages
- Headers
- Pagination
- Lines on a Page and Footers
- Quiz 3
- Exercise 3
- Session 4Formatted Strings
- Printing a Formatted String
- Creating a Formatted String
- Record Separators
- The Input Record Separator
- The Output Record Separator
- Field and List Separators
- Quiz 4
- Exercise 4
- Review
- Session 5Here Strings And Special Literals
- Here Strings
- Special Literals
- Quiz 5
- Exercise 5
- Session 6Advanced Formats
- Multiline Picture Fields
- Accessing Your Formatted Data Without Printing
- Quiz 6
- Exercise 6
- Session 7Generating PostScript
- The PostScript Page Description Language
- PostScript Headers and Footers
- Drawing Lines
- Drawing Text
- Circles, Squares, and Fills
- Quiz 7
- Exercise 7
- Session 8Binary Data
- Binary Data
- TIFF
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 7hOOPla: OBJECT-ORIENTED PROGRAMMING
- Session 1OOP and Packages
- Object-Oriented Programming
- Encapsulation
- Inheritance
- Polymorphism
- Packages
- Quiz 1
- Exercise 1
- Session 2References
- Creating and Accessing References
- A Word About Syntax
- The ref() Function
- Copying References vs. Copying Values
- Symbolic References vs. Hard References
- Quiz 2
- Exercise 2
- Session 3Anonymous Variables and Objects
- Anonymous Variables (and Anonymous Functions)
- Omitting ->
- Anonymous Subroutines and Closures
- Creating Objects
- Quiz 3
- Exercise 3
- Session 4Methods
- Static vs. Virtual Methods
- Passing Arguments to Methods
- Quiz 4
- Exercise 4
- Review
- Session 5Inheritance
- Choosing a Base Class
- Inheritance: Where Does It End?
- Multiple Inheritance
- Inheriting Variables
- Quiz 5
- Exercise 5
- Session 6Advanced OOP Features
- Subpackages
- Access to Overridden Methods
- Destructors
- Reblessing Objects
- Quiz 6
- Exercise 6
- Session 7OOP Design Methods
- A Containing Relationship
- Calling the Right Method
- Class Variables
- Quiz 7
- Exercise 7
- Session 8Overloading
- %OVERLOAD
- Input Arrays for Overloaded Functions
- Overloadable Operations
- $OVERLOAD{nomethod}
- Autogeneration of Functions
- $OVERLOAD{fallback}
- $OVERLOAD{=}
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 8BROWSING THE LIBRARY: MODULES
- Session 1The Perl Library
- Library Files
- Modules
- Pragmas
- The integer Pragma
- The subs Pragma
- Prototypes
- The strict Pragma
- Other Pragmas
- Quiz 1
- Exercise 1
- Session 2English, Time, Syslog, and POD
- English
- English
- Time
- Time::Local
- Syslog
- Sys::Syslog
- POD: Plain Old Documentation
- Quiz 2
- Exercise 2
- Session 3Making Modules
- Exporter
- AutoLoader
- AutoSplit
- Quiz 3
- Exercise 3
- Session 4Getopt and Assert
- Getopt
- Getopt::Std
- Getopt::Long
- Assert
- assert.pl
- Quiz 4
- Exercise 4
- Review
- Session 5Inspecting and Testing
- Config
- Config
- Env
- Env
- Cwd
- Cwd
- Benchmark
- Benchmark
- Sys
- Sys::Hostname
- Dumpvar
- dumpvar.pl
- Quiz 5
- Exercise 5
- Session 6Files
- File
- File::Find
- File::Finddepth
- File::Checktree
- File::Basename
- FileHandle
- FileHandle
- Flush
- flush.pl
- Stat
- stat.pl
- Quiz 6
- Exercise 6
- Session 7Text, Search, and Math
- Text
- text::abbrev
- Text::Soundex
- Text::Tabs
- Text::ParseWords
- Search
- Search::Dict
- Math
- Math::BigInt
- Math::BigFloat
- bigrat.pl
- Math::Complex
- Quiz 7
- Exercise 7
- Session 8Dotsh.pl, Term, and Posix
- dotsh.pl
- dotsh.pl
- Term
- Term::Cap
- Term::Complete
- POSIX
- POSIX
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 9PUSHING THE ENVELOPE: PROCESS MANAGEMENT
- Session 1Eval()
- Trapping Fatal Errors
- Assembling Functions
- Quiz 1
- Exercise 1
- Session 2Signals
- Trapping Signals
- $SIG{__WARN__} and $SIG{__DIE__}
- The sigtrap Pragma
- Sending Signals
- Alarm
- Quiz 2
- Exercise 2
- Session 3Exec() And Fork()
- exec()
- Special Characters in Perl vs. Special Characters in UNIX Shells
- Forking Processes
- Quiz 3
- Exercise 3
- Session 4Process Attributes
- Changing the Process Name
- Getting the PID of the Parent Process
- Process Priorities
- Process Groups
- Quiz 4
- Exercise 4
- Review
- Session 5Wait(), Pipe(), Open2, And Open3
- Waiting for Another Process to Finish
- Whats a Blocking Operation?
- Pipes
- Open2 and Open3
- Quiz 5
- Exercise 5
- Session 6Advanced I/O
- select()
- File Control with fcntl()
- I/O Control with ioctl()
- Term::ReadKey
- Term::ReadLine
- Quiz 6
- Exercise 6
- Session 7Syscall() And Compiling Perl
- System Calls
- Compiling Perl
- The Perl Compiler
- Quiz 7
- Exercise 7
- Session 8System V Interprocess Communication
- Message Queues
- Semaphores
- Shared Memory
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 10WHEN GOOD PROGRAMS GO BAD: DEBUGGING
- Session 1How To Fix It
- Warnings
- Checking Syntax
- Diagnostics
- Bugs in Perl
- Quiz 1
- Exercise 1
- Session 2Perl Pitfalls
- Lists vs. Scalars
- Functions Seek Out Argument Lists
- Functions
- Syntax and Logic
- Operators
- Regular Expressions
- Precedence
- Scoping
- Sorting
- Quiz 2
- Exercise 2
- Session 3Error Messages
- Array Found Where Operator Expected
- Cant Bless Non-Reference Value
- Cant Coerce
- Cant Find String Terminator
- Cant Locate
- Cant Locate
- Cant Modify Constant Item
- Cant Return Outside a Subroutine
- Cant Write to Temp File for -e
- Deep Recursion on Subroutine
-
Follows Nothing in regexp
- INFINITE LOOP 1 (Not an Actual Error Message)
- INFINITE LOOP 2 (Not an Actual Error Message)
- INFINITE LOOP 3 (Not an Actual Error Message)
- INFINITE LOOP 4 (Not an Actual Error Message)
- INFINITE LOOP 5 (Not an Actual Error Message)
- Literal Array Now Requires Backslash at Program Line 2, Within String
- Modification of a Read-Only Value
- Nested *?+ in regexp
- Not Enough Arguments
- Number Found Where Operator Expected
-
Permission Denied
- Precedence Problem
- Recompile Perl with -DDEBUGGING to Use -D Switch
- Sort Subroutine Didnt Return a Numeric Value
- substr Outside of String
- Syntax Error
- Type of arg to Keys Must Be Hash
- Undefined sort Subroutine
- Undefined Subroutine
-
Unmatched [] in regexp
- Unquoted String May Clash with Future Reserved Word
- Use of Uninitialized Value
- Use of
Is Deprecated
- Useless Use
- Quiz 3
- Exercise 3
- Session 4Using the Debugger
- Quiz 4
- Exercise 4
- Review
- Session 5Advanced Debugging
- Quiz 5
- Exercise 5
- Session 6-Ddebugging
- Quiz 6
- Exercise 6
- Session 7Error Handling
- Caller
- Exceptions
- Carp
- Quiz 7
- Exercise 7
- Session 8Efficiency
- Minimizing Time
- Easy Choices
- Hard Choices
- Minimizing Space
- Easy Choices
- Hard Choices
- Profiling Your Code
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 11LOCK AND KEY: SECURITY AND DATABASES
- Session 1Unix Users and Groups
- Quiz 1
- Exercise 1
- Session 2Unix Setuid Scripts and the Safe module
- Real vs. Effective UIDs
- setuid Bits
- Tainted Variables
- The Safe Module
- Quiz 2
- Exercise 2
- Session 3Encryption
- crypt()
- DES
- RSA
- Quiz 3
- Exercise 3
- Session 4Tied Variables
- Quiz 4
- Exercise 4
- Review
- Session 5Database Modules
- Quiz 5
- Exercise 5
- Session 6DBI, the Database Interface
- Using DBI
- DBI Methods
- Quiz 6
- Exercise 6
- Session 7Non-DBI Interfaces, Part I
- Oracle
- Sybase
- Informix
- Ingres
- Quiz 7
- Exercise 7
- Session 8Non-DBI Interfaces, Part II
- Interbase
- UNIFY
- Postgres
- C-Tree
- C-ISAM
- X.500
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 12SURFING ON OYSTERS: PERL AND THE WORLD WIDE WEB
- Session 1A World Wide Web Primer
- HTML
- Links and URLs
- Quiz 1
- Exercise 1
- Session 2Generating WWW Pages
- CGI
- Getting CGI to Find Your Perl Scripts
- Quiz 2
- Exercise 2
- Session 3HTML Forms
- Radio Buttons
- Checkboxes
- <SELECT>
- <TEXTAREA>
- Quiz 3
- Exercise 3
- Session 4Images, Audio, and Video
- Images
- Audio, Video, and Noninlined Images
- Quiz 4
- Exercise 4
- Review
- Session 5Perl/Web Resources
- perlWWW
- CGI.pm
- libwww-perl
- The CGI Module Set
- The URI Module Set
- The HTTP Module Set
- The HTML Module Set
- The WWW Module Set
- The MIME Module Set
- The LWP Module Set
- Quiz 5
- Exercise 5
- Session 6Running a WWW Server
- Plexus
- phttpd
- Quiz 6
- Exercise 6
- Session 7Advanced Webbery
- Security
- Netscape, SSL, and HTTPS
- Firewalls
- Dynamic Documents
- Java
- Penguin
- Server Push and Client Pull
- Weblint, htmlchek, linkcheck, and verify_links
- Weblint
- htmlchek
- linkcheck
- verify_links
- webget and url_get
- webget
- url_get
- Mail
- MHonArc
- Hypermail
- Quiz 7
- Exercise 7
- Session 8Non-Web Internet Services
- FTP
- IRC
- WAIS
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 13SPREADING THE WORD: NETWORKING
- Session 1How the Internet Works
- Protocol Layers
- Ports
- Quiz 1
- Exercise 1
- Session 2Networking Utilities
- rsh
- comm.pl and chat2.pl
- inetd
- Quiz2
- Exercise 2
- Session 3Sockets
- Quiz 3
- Exercise 3
- Session 4Multiuser Services
- Quiz 4
- Exercise 4
- Review
- Session 5Interactive Services
- Quiz 5
- Exercise 5
- Session 6Bulletproofing Servers
- Zombie Processes
- Reusing Local Addresses
- Server Exclusivity
- Quiz 6
- Exercise 6
- Session 7Advanced Sockets
- Using socketpair() to Create a Two-Way Pipe
- Socket Addresses
- Socket Control
- shutdown()
- send() and recv()
- Quiz 7
- Exercise 7
- Session 8Network Databases
- Hosts
- Services
- Protocols
- Networks
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
- CHAPTER 14TOWER OF BABEL: PERL AND OTHER LANGUAGES
- Session 1X
- Tcl, Tk, X: Whats the Difference?
- General Perl/Tk Information
- Simple Tk Programs
- Quiz 1
- Exercise 1
- Session 2More X
- Text Widgets and Dialog Boxes
- Animation
- Tk Utilities
- Quiz 2
- Exercise 2
- Session 3Curses
- Quiz 3
- Exercise 3
- Session 4Awk, Sed, and Find
- awk
- sed
- find
- Quiz 4
- Exercise 4
- Review
- Session 5Using C from Perl
- The Perl Compiler
- The C Preprocessor
- Source Filtering
- Using C Functions and Libraries
- Extensions
- XS
- Linking a C Function into Perl
- Linking a C Library into Perl
- Quiz 5
- Exercise 5
- Session 6Advanced XS
- Modifying Input Arguments and Passing Strings to an XSUB
- Multiple XSUBs
- The CODE: keyword
- Types and the typemap
- Quiz 6
- Exercise 6
- Session 7Using Perl from C
- Quiz 7
- Exercise 7
- Session 8Using the Perl Stack from C
- Playing with the Stack
- The perl_call_ Functions
- Quiz 8
- Exercise 8
- Review
- Chapter Exercise
- Easy
- Medium
- Moderate
- Hard
Appendix A
Appendix B
Appendix C
Appendix D
Appendix E
Appendix F
Appendix G
Appendix H
Appendix I
Appendix J
Appendix K
Index