Perl For Dummies (Google eBook)

Front Cover
John Wiley & Sons, May 9, 2011 - Computers - 408 pages
0 Reviews
In the days before personal computers, BASIC was the easy programming language to learn, and serious programmers learned FORTRAN or COBOL to do “real work.” Today, many people have discovered that Perl is both a great beginning programming language and one that enables them to write powerful programs with little effort.

If you’re interested in discovering how to program (or how others program), Perl For Dummies, 4th Edition, is for you. If you already know something about programming (but not about Perl), this book is also for you. If you’re already an expert programmer, you’re still welcome to read this book; you can just skip the basic stuff (you never know what kind of new tips and tricks you’ll pick up).

This reference guide shows you how to use Perl under many different operating systems, such as UNIX, many flavors of Windows (Windows 95/98, Windows NT, Windows 2000, Windows Me, and Windows XP), and Macintosh OS 9 and OS X; in fact, Perl runs on many more operating systems than these.

Here's a sampling of what Perl For Dummies, 4th Edition, has to offer:

  • Installing Perl on various platforms
  • Nailing down the basics of building Perl programs
  • Working with text and numbers
  • Constructing lists and working with them
  • Creating conditionals and loops
  • Delving into more advanced features such as operators and functions
  • Reading and writing files and directories
  • Using subroutines for modularity
  • Demystifying Web server programs
  • Creating your own Internet clients

The Perl programming language enables you to write fully working computer programs with just a few steps. It’s particularly good at common programming tasks, such as reading and writing text files, but it also excels at reducing the work that programmers have to do. Perl For Dummies, 4th Edition, shows you how to do all of that and how to modify programs to your heart’s content. After all, one of the common phrases in the world of Perl programmers is, “There's more than one way to do it.”


What people are saying - Write a review

Review: Perl for Dummies

User Review  - Chang - Goodreads

It was a great reference! Read full review

Review: Perl for Dummies

User Review  - RJ - Goodreads

Perl for Dummies (Fourth Edition) by Paul Hoffman (2003) Read full review


What You Need to Know First
The Basic Perl Programming Ingredients
Icons Used in This Book
Part I
Chapter 1
Understanding the Purpose of Programming
Making Computers Compute
Choosing a file opening mode
Determining whether a file really opened
Using files after theyre opened
Specifying Filenames and DirectoryPaths for Various Operating Systems
Reading from a Text File the Easy Way
Writing Text to a File the Easy Way
Running Tests to Get Information on a File
Standard In Standard Out and Standard Error

Translating Your Language into Computer Language
Designing Computer Languages
Appreciating the Benefits of Perl
Many Versions One Perl
Differentiating Between Perl 5 and Perl 56
Exploring the New Features of Perl 58
Chapter 2
Playing the name game
Determining whether you need to install Perl on UNIX
Installing Perl on UNIX
Running Perl programs under UNIX
ActivePerl on Windows
Running ActivePerl in a command prompt window
Perl for Mac Users
Running MacPerl programs
Working with Perl on the Command Line
Checking syntax with the c option
Running oneliners with the e option
Utilizing the Comprehensive Perl Archive Network
Working with the ActivePerl Package Manager
Getting Help
Chapter 3
Examining Some Basic Components of a Perl Program
Inserting a comment
Creating Perl Programs Using Statements
Ending statements
Introducing operators and functions
Indenting and Spacing
Indenting blocks
Adding extra spacing for the fun of it
Working with Variables and Literals
Assigning variables
Using Perls special variables
Chapter 4
Running the counter1pl sample program
Viewing the program results
Breaking down the sample program
Running the empdata1pl sample program
Forgetting a semicolon
Entering one parenthesis too many or too few
Part II
Chapter 5
The print Statement
Differentiating between Visible Characters and Character Values
Recognizing defined and undefined values
Using special characters in text
Quoting Text
Using functions to quote text
Quoting large blocks of text
Manipulating Strings
Making lots of copies
Performing Simple String Transformations
Getting Information from Strings
Introducing Unicode and UTF8
Using international characters
Chapter 6
Using Perls Basic Math Operators
Utilizing parentheses in algebraic calculations
Working with the positive and negative value operator
Doing Math and an Assignment at the Same Time
Autoincrementing and Autodecrementing
Employing Simple Numeric Functions
Converting Numbers into Strings
Working with Really Big Numbers
Counting in Nondecimal Number Systems
Chapter 7
Constructing basic lists
Understanding variable names
Using Lists to Simplify Basic Tasks
Using the print Statement with Lists
Adding and Removing List Elements
Removing elements from a list with the shift and pop functions
Splitting Strings with the split Function
Using Scalar Variables
Util in Perl 58
Understanding the Basics of Working with Hashes
Locating items by their keys
Comparing hashes with standard lists
Adding records to a hash
Examining records with the keys function
Checking for any existing records
Creating Multidimensional Lists
Creating twodimensional lists
Accessing list elements one piece at a time
Adding rows and columns to twodimensional lists
Creating Hashes Consisting of Lists
Writing the Files for Lists within Lists
Text files for twodimensional lists of lists
Chapter 8
Using the math operators
Using the string operators
Linking conditional tests
Using the xor operator
The unless statement
Conditional operators
Looping with the while statement
Navigating with the next and last statements
Utilizing the for statement
Using the map statement with lists
Creating switch structures in Perl 58
Opening files with the open function
Jumping around Programs by Using Labels
Chapter 9
Looking for Strings within Strings
Using the index function
Applying Some Fancy Formatting to Text and Numbers
Tracking Time
Picking Random Numbers
Shifting Bits with BitLevel Operators
Converting Lists to Strings
Rearranging Lists
Part III
Chapter 10
Opening and Closing Files
Piping data in and out of a program
Chapter 11
Keeping track of your position in a file
Writing to a binary file
Forcing binary reads
Renaming files
Grouping Filenames by Matching Characters
File Features Strictly for UNIX Users
Creating links with functions
Getting the NittyGritty Stats on Files
Working with Directories of Files
Walking through directories
Creating and destroying directories
Chapter 12
Working with Regular Expressions
Tightening up your statements
Accounting for those special metacharacters
Making Inexact Matches in Regular Expressions
Matching character classes
Searching the Beginning or End of a String
Using Quantifiers for Numerical Matches
Getting the Match Results
More Programming Magic with the m Operator
Doing global searches in the m operator
Searching for multiple lines in a string
Doing Simple Substitutions with the s Operator
Using match results in your substitutions
Using expressions in the replacement text of s
Quoting words
Using the tr Operator
Chapter 13
Structuring a subroutine
Saving on labor and avoiding errors with subroutines
Using the my and local functions
Returning a value from a subroutine
Importing Prewritten Perl Code into Your Programs
Adding a required statement for included files
Helping Perl search your libraries for included files
Wrapping your programs in packages
Including code other than subroutines
Using the die function
Structuring die and exit statements
Part IV
Chapter 14
Writing CGI Programs in Perl
Using Environment Variables
Getting at variables
Posing a query
Gathering Information from HTML Forms
Using GET and POST to Collect Form Data
Picking values to use as Perl variables
Displaying Output to the User
Displaying information directly using print statements
Using the CGI module to display to the user
Creating an HTML Form
Using Redirection to Link to Other Sites
Exploring a Few Other Environment Variables
Gathering additional client information
Working with Apache and Perl
Handling CGI and HTML with Mason
Chapter 15
Using the libwwwperl Library
Getting documents from the Web and FTP
Testing Web links with a Perl program
Using libwwwperl with objects
Getting Your EMail
Creating a simple client object
Examining a program for processing reports in your mailbox
Pinging with Perl
Delving into Domain Names with Perl
Chapter 16
Introducing XML
Combining XML and Perl
Checking a Document for Accuracy
How Do You Want to Read It?
Parsing XML as a tree
Writing an XML Document
Reading and Writing XML in Other Ways
Looking into Web Services
Chapter 17
Opening Databases
Closing Databases
Chapter 18
Getting output from a program
Using the open function
Controlling a Windows or Mac Computer with Perl
Using UNIXOnly System Functions
Accessing group databases
Chapter 19
Defining Objects Methods and Arguments
Perls Objects Made Easy
Opening a Perl module with the use function
Invoking an objects methods
Part V
Chapter 20
Choosing Your Operator
Flexible Ordering for Conditionals
Commenting about Comments
Comments Cohabitating with Code
Capital Offense or Not?
The Beauty of Blank Lines
Chapter 21
Printing Lines from a File in Sorted Order
Listing Just the Files in a Directory
Creating a Simple Calculator
Generating Random Mnemonic Passwords
Part VI
Perls Operator Hierarchy
Perls Functions and Statements
Perls Special Variables
Variables that relate to errors and return values
Variables that relate to processes
Perls Predefined File Handles

Common terms and phrases

About the author (2011)

Paul Hoffman has written and contributed to numerous Internet standards. He’s a 20-year Internet veteran and the author of more than a dozen computer books.

Bibliographic information