
Perl Programming For The Absolute Beginner
by Ford,Jr., Jerry Lee-
Free Shipping On Orders Over $35
Your order must be $35 or more to qualify for free economy shipping. Marketplace items, eBooks and apparel do not qualify towards the $35 purchase minimum.
Rent Book
New Book
We're Sorry
Sold Out
Used Book
We're Sorry
Sold Out
eBook
We're Sorry
Not Available
How Marketplace Works:
- This item is offered by an independent seller and not shipped from our warehouse
- Item details like edition and cover design may differ from our description; see seller's comments before ordering.
- Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
- Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
- Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.
Summary
Table of Contents
Introduction | p. xii |
Introducing Perl | p. 1 |
Perl Basics | p. 3 |
Project Preview: The Perl Humor Script | p. 4 |
Perl Scripting Overview | p. 6 |
A Little Perl History | p. 7 |
Where's Perl 6? | p. 8 |
What Can Perl Scripts Do? | p. 8 |
The Programming Language, the Interpreter, and Scripts | p. 9 |
Working from the Command Prompt | p. 10 |
Accessing the Command Prompt on Windows XP | p. 10 |
Accessing the Command Prompt on Mac OS X | p. 11 |
Accessing the Command Prompt in Unix and Linux | p. 12 |
Not Everything Smells Like Roses | p. 12 |
Determining if Perl Is Installed on Your Computer | p. 13 |
Where to Find Perl | p. 14 |
Where to Find Perl's Documentation | p. 17 |
Perldoc | p. 17 |
Man Pages | p. 19 |
ActiveState Documentation | p. 19 |
Writing Your First Perl Scripts | p. 20 |
Creating Perl One-liners | p. 20 |
Writing Your First Perl Script File | p. 21 |
Dissecting Hello.pl | p. 22 |
How Perl Executes Your Script | p. 24 |
Back to the Perl Humor Script | p. 24 |
Designing the Game | p. 24 |
The Final Result | p. 27 |
Summary | p. 29 |
Working with Strings, Numbers, and Operators | p. 31 |
Project Preview: The Story of William the Great | p. 31 |
Perl's Free-Wheeling Approach to Code Structure | p. 34 |
Perl's Flexible View of Data | p. 37 |
Working with Strings | p. 37 |
Working with Numbers | p. 41 |
Converting Scalar Data | p. 41 |
Storing Data in Scalar Variables | p. 42 |
Variable Scope | p. 42 |
Assigning Data to Scalar Variables | p. 43 |
Variable Interpolation | p. 43 |
Understandings How to Work with Perl Operators | p. 44 |
String Operators | p. 44 |
Arithmetic Operators | p. 46 |
Increment and Decrement Operators | p. 48 |
Assignment Operators | p. 48 |
Relational Operators | p. 49 |
Logical Operators | p. 50 |
Input and Output | p. 51 |
Working with Standard Input | p. 51 |
Working with Standard Output | p. 52 |
Back to the Story of William the Great | p. 52 |
Designing the Game | p. 52 |
The Final Result | p. 58 |
Summary | p. 63 |
Mastering Key Perl Programming Constructs | p. 65 |
Controlling Program Flow | p. 67 |
Project Preview: The Perl Fortune Teller Game | p. 68 |
Code Blocks | p. 70 |
Applying Conditional Logic | p. 72 |
Perl's View of What's True and False | p. 72 |
Variations of the if Statement | p. 73 |
The unless Statement | p. 79 |
Creating More Sophisticated Conditional Logic | p. 80 |
Nesting | p. 80 |
Working with the ?...: Conditional Operator | p. 81 |
Creating Custom Conditional Structures | p. 81 |
Setting Up Loops | p. 83 |
While | p. 84 |
Until | p. 86 |
Do | p. 88 |
For | p. 89 |
Foreach | p. 90 |
Adding Continue Blocks to Your Loops | p. 91 |
Loop Controls | p. 92 |
The last Statement | p. 92 |
The next Statement | p. 93 |
The redo Statement | p. 93 |
Adding Labels to Your Code Blocks and Loops | p. 93 |
Back to the Perl Fortune Teller Game | p. 94 |
Designing the Game | p. 94 |
The Final Result | p. 100 |
Summary | p. 103 |
Working with Collections of Data | p. 105 |
Project Preview: The Star Wars Quiz | p. 106 |
Working with Collections of Related Data | p. 108 |
Assigning Data to a List | p. 108 |
Working with Arrays | p. 110 |
Declaring an Array | p. 110 |
Populating and Modifying Arrays with Data | p. 112 |
Retrieving Data from an Array | p. 113 |
Sorting Array Elements | p. 117 |
Deleting Array Elements | p. 118 |
Using Arrays to Populate Variables and Other Arrays | p. 119 |
Ensuring That Array Elements Exist | p. 120 |
Dealing with Undefined Array Elements | p. 120 |
Creating Hashes | p. 120 |
Adding and Deleting Hash Elements | p. 122 |
Processing Hash Contents | p. 123 |
Sorting Hash Values | p. 124 |
Converting Between Arrays and Hashes | p. 124 |
Understanding Context within Perl | p. 124 |
Scalar Context | p. 125 |
Numeric Context | p. 125 |
Boolean Context | p. 126 |
Scalar Versus List Context | p. 126 |
Context and Lists, Arrays, and Hashes | p. 127 |
Back to the Star Wars Quiz | p. 128 |
Designing the Game | p. 128 |
The Final Result | p. 136 |
Summary | p. 142 |
Improving Script Organization and Structure | p. 145 |
Project Preview: The Pick a Number Game | p. 145 |
Enhancing Script Organization | p. 149 |
Organizing Perl Scripts Using Subroutines | p. 151 |
Defining Subroutines | p. 151 |
Executing Subroutines | p. 152 |
A Template for Organizing Your Scripts and Subroutines | p. 153 |
The Fortune Teller Game Revisited | p. 154 |
Passing Arguments to Subroutines | p. 159 |
Passing Data to Subroutines for Processing | p. 160 |
Accessing Subroutine Arguments | p. 161 |
Reassigning Subroutine Arguments | p. 162 |
Passing Lists, Arrays, and Hashes as Arguments | p. 163 |
Getting Data Back from Subroutines | p. 164 |
Controlling Variable Scope | p. 166 |
Creating Private Variables | p. 166 |
Getting Strict with Private Variables | p. 167 |
Creating Local Variables | p. 168 |
Back to the Pick a Number Game | p. 169 |
Designing the Game | p. 169 |
The Final Result | p. 177 |
Summary | p. 183 |
Scope and Modules | p. 185 |
Project Preview: The Rock, Paper, Scissors Game | p. 186 |
Exercising Additional Control over Variable Scope | p. 189 |
Working with Perl Modules | p. 190 |
The Perl Library | p. 191 |
Accessing Module Documentation | p. 191 |
Importing Modules into Perl Scripts | p. 191 |
Building Custom Modules | p. 193 |
Defining a New Perl Module | p. 194 |
Saving Your Custom Modules | p. 196 |
Importing and Using Custom Perl Modules | p. 197 |
Using Other People's Perl Modules | p. 198 |
PPM | p. 198 |
CPAN | p. 200 |
Back to the Rock, Paper, Scissors Game | p. 202 |
Building the Clear_the_screen Module | p. 203 |
Designing the Game | p. 203 |
The Final Result | p. 214 |
Summary | p. 223 |
Advanced Topics | p. 225 |
Regular Expressions | p. 227 |
Project Preview: The Lottery Picker Game | p. 228 |
Introducing Regular Expressions | p. 230 |
Matching Simple Patterns | p. 231 |
Creating Simple Patterns | p. 232 |
Shorter Pattern Footprints | p. 232 |
Working with Metacharacters | p. 234 |
Matching Patterns at the Beginning of a String | p. 234 |
Matching Patterns at the End of a String | p. 235 |
Matching One or Fewer Times | p. 236 |
Matching Any Single Character | p. 236 |
Matching Zero or More Instances | p. 237 |
Matching One or More Instances | p. 238 |
Matching a Range of Instances | p. 238 |
Matching Alternative Patterns | p. 238 |
Matching Any of a Collection of Characters | p. 239 |
Other Regular Expression Tips and Tricks | p. 241 |
Using Patterns to Replace Data | p. 241 |
Performing Character Translation | p. 242 |
Handling Differences in Case | p. 242 |
Matching Data Stored in Lists | p. 243 |
Back to the Lottery Picker Game | p. 244 |
Designing the Game | p. 244 |
The Final Result | p. 255 |
Summary | p. 264 |
Debugging | p. 26 |
Project Preview: The Tic Tac Toe Game | p. 268 |
Understanding Perl Script Errors | p. 271 |
Syntax Errors | p. 272 |
Runtime Errors | p. 272 |
Logical Errors | p. 273 |
Examining Perl Error Messages | p. 273 |
Tracing Logical Flow with the Print Function | p. 275 |
Using the Perl Debugger to Track Down Pesky Bugs | p. 276 |
Starting the Debugger | p. 276 |
Executing Additional Code Statements | p. 278 |
Resuming or Restarting Execution | p. 280 |
Tracing Logic Flow | p. 281 |
Quitting the Debugger | p. 282 |
Locating Your Position within the Script | p. 282 |
Displaying and Modifying Variable Values | p. 282 |
Displaying Help Information | p. 283 |
Executing any Perl Statement | p. 284 |
Setting and Working with Breakpoints | p. 285 |
Using the Perl Debugger as an Interactive Test Environment | p. 287 |
Using a Graphical Perl IDE/Debugger | p. 287 |
Tips for Writing Cleaner Code | p. 289 |
Document What Your Script Is Doing | p. 289 |
Enable Warnings | p. 289 |
Add Use Strict | p. 290 |
Keep Things Simple | p. 291 |
Break Things Down into Subroutines | p. 292 |
Back to the Tic Tac Toe Game | p. 292 |
Designing the Game | p. 292 |
The Final Result | p. 306 |
Summary | p. 318 |
Appendices | p. 321 |
Perl Scripting Examples | p. 323 |
CGI Scripting | p. 324 |
Creating a Basic CGI File | p. 324 |
Executing Perl CGI Scripts | p. 325 |
Working with the CGI.pm Module | p. 327 |
Creating Reports and Documents | p. 328 |
Opening Files for Reading | p. 328 |
Reacting to Failures when Opening Files | p. 329 |
Reading File Contents | p. 329 |
Opening Files for Writing | p. 331 |
Writing File Output | p. 332 |
Closing Files when Done | p. 332 |
Managing Files and Directories | p. 333 |
Managing Files | p. 333 |
Managing Directories | p. 335 |
PerlScript and the WSH | p. 337 |
What's on the Companion Website? | p. 343 |
The Book's Source Code | p. 343 |
Advanced Text Editors | p. 344 |
JGsoft EditPad Lite | p. 345 |
JGsoft EditPad Pro | p. 345 |
Perl Editors | p. 347 |
Perl Code Editor | p. 347 |
Perl Builder 2.0 | p. 347 |
DzSoft Perl Editor | p. 348 |
Komodo | p. 348 |
PerlEdit | p. 350 |
What Next? | p. 351 |
Recommended Reading | p. 351 |
Locating Perl Resources Online | p. 352 |
perl.com | p. 353 |
The Perl Directory at Perl.org | p. 353 |
Perlmonks | p. 353 |
The Comprehensive Perl Archive Network | p. 355 |
The Perl Foundation | p. 355 |
Perl Mailing Lists | p. 356 |
perl.beginners | p. 356 |
Yahoo! Groups: perl.beginners | p. 356 |
Glossary | p. 359 |
Index | p. 369 |
Table of Contents provided by Ingram. All Rights Reserved. |
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.