BN.com Gift Guide

Sams Teach Yourself Perl in 24 Hours

( 1 )

Overview

Learn Perl programming quickly and easily with 24 one-hour lessons in Sams Teach Yourself Perl in 24 Hours. The book's step-by-step lessons teach you the basics of Perl and how to apply it in web development and system administration. Plus, the third edition has been updated to include five chapters on new technologies, information on the latest version of Perl, and a look ahead to Perl 6. Sams Teach Yourself Perl in 24 Hours focuses on real-world development, teaching you how ...

See more details below
Paperback (REV)
$26.24
BN.com price
(Save 25%)$34.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (18) from $5.00   
  • New (5) from $19.28   
  • Used (13) from $5.00   
Sending request ...

Overview

Learn Perl programming quickly and easily with 24 one-hour lessons in Sams Teach Yourself Perl in 24 Hours. The book's step-by-step lessons teach you the basics of Perl and how to apply it in web development and system administration. Plus, the third edition has been updated to include five chapters on new technologies, information on the latest version of Perl, and a look ahead to Perl 6. Sams Teach Yourself Perl in 24 Hours focuses on real-world development, teaching you how to:

  • Effectively use Perl for large development projects using Perl modules
  • Use Perl for data processing
  • Utilize Perl as a "glue" language with other programming languages
  • Use Perl as a web development language
Read More Show Less

Product Details

  • ISBN-13: 9780672327933
  • Publisher: Sams
  • Publication date: 6/21/2005
  • Series: Teach Yourself -- Hours Series
  • Edition description: REV
  • Edition number: 3
  • Pages: 480
  • Sales rank: 1,399,957
  • Product dimensions: 6.92 (w) x 9.05 (h) x 1.10 (d)

Meet the Author

Sams Teach Yourself Perl in 24 Hours, Third Edition About the Author

Clinton Pierce is a software engineer, freelance programmer, and instructor. He has been answering questions about Perl on USENET for many years and has been writing courseware and teaching Perl to his co-workers and anyone else who will listen for about as long. He is a software engineer for a payroll company, who, when not designing middleware software to integrate legacy systems to the Web, navigating the intricacies of payroll taxes, teaching UNIX and Perl, writing books and articles, or writing programs at home Just For The Fun Of It, harbors secret dreams of being abducted by wood nymphs and living in the deep forest without technology. You can visit his Web site at http://www.geeksalad.org for updates and corrections, or just to say hello.

Read More Show Less

Read an Excerpt

IntroductionIntroduction

"Any sufficiently advanced technology is virtually indistinguishable from magic." —Arthur C. Clarke

Remember this well: There's nothing magical about programming a computer.

Like anything that seems magical, there's always a trick to it—and programming is no different. All you need are some analytical thinking skills, the desire to learn, and some time to learn Perl. The best way to learn how to program a computer—or any task really—is to have a goal. Your goal could be to spice up your Web pages, convert a program you already have to Perl, or to satisfy idle curiosity—it doesn't really matter.

Now, given that you've established a goal and have some thinking skills, what does this book have for you?

This book will teach you the basics of the Perl programming language. You'll learn just enough Perl to do something useful. You will not be overwhelmed with details that, although interesting, will only get in your way and that you'll probably never use again. Each new concept in this book is demonstrated by lots of working code examples. Go ahead—flip through the book and see.

But why Perl? Almost every company that uses programming of some kind uses Perl. Perl is found in finance, manufacturing, genetics, the military, and every other application known to humankind. And, of course, Perl is used on the Internet and the World Wide Web. Perl isn't going away any time soon, which is why learning it is an investment in your time that will pay off for years to come.

It's also possible to create really stunning Perl programs with just a small bit of code. Using a little bit of Perl to glue together other applications, languages, and technologies, you'll be creating useful Perl programs in no time.

How to Use This Book

This book is divided into 24 segments that take roughly an hour to complete. You can work through the lessons in the space of a day (if you don't plan to eat or sleep), or you can take your time and work through the hour lessons at your own pace.

At the end of each hour, you'll be able to accomplish a new set of tasks. The lessons contain clear explanations of the language features and how they work. In addition, each hour provides you with the opportunity for hands-on training, simply by following the steps described.

Conventions Used in This Book

Sams Teach Yourself Perl in 24 Hours uses a number of conventions that are consistent throughout this book:

  • Each hour begins with an overview of what you will learn.
  • Step-by-step instructions are preceded by a To Do icon.
  • Every hour ends with a summary and a series of commonly asked questions and answers; hopefully, you'll find the answers to your questions among them.

In addition, these elements appear throughout the book:

Note - Notes provide you with comments and asides about the topic at hand.

Tip - Tips offer shortcuts and hints on getting the task done.

Caution - Cautions explain roadblocks you might encounter when you work with Perl and tell you how to avoid them.

New terms are emphasized by being placed in bold for your easy reference.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Table of Contents

Introduction.

How to Use This Book

Conventions Used in This Book

I. PERL FUNDAMENTALS.

Hour 1: Getting Started with Perl.

Installing Perl

Stop! Wait! Maybe You Already Have Perl

Installing Perl on Windows

Installing Perl on Unix

Installing Perl on Mac OS

Documentation

Some Special Documentation Cases

What If You Can't Find the Documentation?

Your First Program

Typing Your First Program

Running the Program

It Worked! So What Happened?

Perl Play-by-Play

Something You Should Know

Hour 2: Perl's Building Blocks: Numbers and Strings.

Literals

Numbers

Strings

Scalar Variables

The Special Variable $_

Expressions and Operators

Basic Operators

Numeric Operators

String Operators

More Operators

One-Operand (Unary) Operators

Increment and Decrement

Angle Operator (<>)

More Assignment Operators

A Few Words on Strings and Numbers

Exercise: Interest Calculator

Hour 3: Controlling the Program's Flow.

Blocks

The if Statement

The Other Relational Operators

What Truth Means to Perl

Logical Operators

Looping

Looping with while

Looping with for

Other Flow Control Tools

Odd Arrangements

Fine-Grained Control

Labels

Leaving Perl

Exercise: Finding Primes

Hour 4: Stacking Building Blocks: Lists and Arrays.

Putting Things into Lists and Arrays

Arrays

Getting Elements Out of an Array

Finding the End of an Array

Learning More about Context

More about the Size and End of an Array

Context with Operators and Functions

Manipulating Arrays

Stepping Through an Array

Converting Between Arrays and Scalars

Reordering Your Array

Exercise: Playing a Little Game

Hour 5: Working with Files.

Opening Files

Pathnames

A Good Defense

Dieing Gracefully

Reading

Writing

Free Files, Testing Files, and Binary Data

Free Filehandles

Text Files and Binary Files

File Test Operators

Hour 6: Pattern Matching.

Simple Patterns

Rules of the Game

The Metacharacters

A Simple Metacharacter

The Unprintables

Quantifiers

Character Classes

Grouping and Alternation

Anchors

Substitution

Exercise: Cleaning Up Input Data

Pattern Matching Odds and Ends

Working with Other Variables

Modifiers and Multiple Matching

Backreferences

A New Function: grep

Hour 7: Hashes.

Filling Your Hash

Getting Data Out of a Hash

Lists and Hashes

Hash Odds and Ends

Testing for Keys in a Hash

Removing Keys from a Hash

Useful Things to Do with a Hash

Determining Frequency Distributions

Finding Unique Elements in Arrays

Computing the Intersection and Difference of Arrays

Sorting Hashes

Exercise: Creating a Simple Customer Database with Perl

Hour 8: Functions.

Creating and Calling Subroutines

Returning Values from Subroutines

Arguments

Passing Arrays and Hashes

Scope

Other Places for my

Exercise: Statistics

Function Footnotes

Declaring Variables local

Making a Stricter Perl

Recursion

II. ADVANCED FEATURES.

Hour 9: More Functions and Operators.

Searching Scalars

Searching with index

Searching Backward with rindex

Picking Apart Scalars with substr

Transliteration, Not Substitution

A Better Way to print

Formatted Printing with printf

Specifying the Field Formats

Formatted Output to a String

Exercise: A Formatted Report

New Ways with Arrays

A List as a Stack

Splicing Arrays

Hour 10: Files and Directories.

Getting a Directory Listing

Globbing

Exercise: The Unix grep

Directories

Navigating Directories

Creating and Removing Directories

Removing Files

Renaming Files

Unix Stuff

A Crash Course in File Permissions

Everything You Ever Wanted to Know About THAT File

Exercise: Renaming Files En Masse

Hour 11: System Interaction.

The system() Function

The Underlying Command Interpreter

Capturing Output

Avoiding Your Shell

Pipes

First Lesson in Portability

Telling the Difference: An Example

Hour 12: Using Perl's Command-Line Tools.

What Is the Debugger?

Starting the Debugger

Basic Debugger Commands

Breakpoints

Other Debugger Commands

Exercise: Finding the Bug

Other Command-Line Stuff

One-Liners

Other Switches

Empty Angle Brackets and More One-Liners

Hour 13: References and Structures.

Reference Basics

References to Arrays

References to Hashes

References as Arguments

Building Structures

Recipes for Structures

Example: A List of Lists

Other Structures

Debugging with References

Exercise: Another Game, Maze

Hour 14: Using Modules.

A Gentle Introduction

Reading the Documentation

What Can Go Wrong?

A Quick Tour

Exploring Files and Directories

Copying Files

Is Anybody Out There?

Once Again, in English?

More Diagnostics

Full List of Standard Modules

Where Do You Go from Here?

Hour 15: Finding Permanence.

DBM Files

Important Points to Know

Walking Through DBM-Tied Hashes

Exercise: A Free-Form Memo Pad

Text Files as Databases

Inserting into or Removing from a Text File

Random File Access

Opening Files for Read and Write

Moving Around in a Read/Write File

Locking

Locking with Unix and Windows

Reading and Writing with a Lock

Locking with Windows 95 and Windows 98

Locking Elsewhere

Hour 16: The Perl Community.

What's Perl All About, Anyway?

A Brief History of Perl

Open Source

The Development of Perl

The Comprehensive Perl Archive Network (CPAN)

What Is CPAN?

Why Do People Contribute?

Your Next Steps

Your First Step

Your Most Useful Tool

Debug Your Program

First, Help Yourself

Learn from the Mistakes of Others

When All Else Fails, Ask

Another Place to Look and Ask: PerlMonks

Other Resources

III. APPLYING PERL.

Hour 17: Writing Modules.

Building a Module

Calling the Module

Namespaces

Scoping Revisited

Another statement: our

Forcing Your Names on Others

Example: A Module to Handle Common File Information Requests

Hour 18: Object Primer.

Classes, Properties, and Methods

A Thought-class: Car

Example: Implementation of Car in Perl

Using the Car Class

Example: File Information Class

Using the File Information Class

Hour 19: Data Processing.

How to Look at Data

Unstructured Data

Table Data

Hierarchical Data

Binary Data

Dealing with Table Data

Example: Email Order Taker

Example: Verifier for the Email Order

XML Data

Reading XML Using Regular Expressions

Reading XML with XML::Simple

Example: Extending Your Ordering System for XML Input

Hour 20: Perl as a Glue Language.

Weather Station

Part 1: Finding Out Where You Are

Part 2: Finding the Local Airport

Part 3: Fetching the Weather and Putting It All Together

Presenting Data as PDF

Example: Weather Report as PDF

Reading and Writing Excel Spreadsheets

Using Perl to Create a Spreadsheet

Reading the Spreadsheet

Hour 21: Introduction to CGI.

Browsing the Web

Fetching a Static Web Page

Dynamic Web Content-The CGI

Don't Skip This Section

The Checklist

Your First CGI Program

Installing the CGI Program on the Server

Running Your CGI Program

What to Do When Your CGI Program Doesn't Work

Is It Your CGI Program?

Server Problems

Fixing Internal Server or 500 Errors

Hour 22: Basic Forms.

How Forms Work

Short Review of HTML Form Elements

What Happens When You Click Submit?

Passing Information to Your CGI Program

GET and POST Methods

Web Security 101

A Clear Link

Watching for Insecure Data

Doing the Impossible

Denial of Service

A Guestbook

Hour 23: Complex Forms.

The Stateless Web

Hidden Fields

The Online Store

A Multipage Survey

Hour 24: Manipulating HTTP and Cookies.

The HTTP Conversation

Example: Fetching a Page Manually

Redirection

More Details on Calling CGI Programs

Passing Parameters to CGI Programs

Special Parameter Considerations

Cookies

How to Make Cookies

Example: Using Cookies

Restricting Cookies

Long Term Cookies

Problems with Cookies

Cookies Are Ephemeral

Cookies Aren't Always Supported

Some People Don't Like Cookies

IV. APPENDIXES.

Appendix A: Installing Modules.

Picking the Right Module

Installing the Modules Under

Windows

UNIX, Using CPAN

UNIX, The Hard Way

Mac OS X

What to Do When You're Not Allowed to Install Modules

Using Modules Installed in Strange Places

Index.

Read More Show Less

Preface

Introduction

"Any sufficiently advanced technology is virtually indistinguishable from magic." —Arthur C. Clarke

Remember this well: There's nothing magical about programming a computer.

Like anything that seems magical, there's always a trick to it—and programming is no different. All you need are some analytical thinking skills, the desire to learn, and some time to learn Perl. The best way to learn how to program a computer—or any task really—is to have a goal. Your goal could be to spice up your Web pages, convert a program you already have to Perl, or to satisfy idle curiosity—it doesn't really matter.

Now, given that you've established a goal and have some thinking skills, what does this book have for you?

This book will teach you the basics of the Perl programming language. You'll learn just enough Perl to do something useful. You will not be overwhelmed with details that, although interesting, will only get in your way and that you'll probably never use again. Each new concept in this book is demonstrated by lots of working code examples. Go ahead—flip through the book and see.

But why Perl? Almost every company that uses programming of some kind uses Perl. Perl is found in finance, manufacturing, genetics, the military, and every other application known to humankind. And, of course, Perl is used on the Internet and the World Wide Web. Perl isn't going away any time soon, which is why learning it is an investment in your time that will pay off for years to come.

It's also possible to create really stunning Perl programs with just a small bit of code. Using a little bit of Perl to glue together other applications, languages, and technologies, you'll be creating useful Perl programs in no time.

How to Use This Book

This book is divided into 24 segments that take roughly an hour to complete. You can work through the lessons in the space of a day (if you don't plan to eat or sleep), or you can take your time and work through the hour lessons at your own pace.

At the end of each hour, you'll be able to accomplish a new set of tasks. The lessons contain clear explanations of the language features and how they work. In addition, each hour provides you with the opportunity for hands-on training, simply by following the steps described.

Conventions Used in This Book

Sams Teach Yourself Perl in 24 Hours uses a number of conventions that are consistent throughout this book:

  • Each hour begins with an overview of what you will learn.
  • Step-by-step instructions are preceded by a To Do icon.
  • Every hour ends with a summary and a series of commonly asked questions and answers; hopefully, you'll find the answers to your questions among them.

In addition, these elements appear throughout the book:


Note - Notes provide you with comments and asides about the topic at hand.


Tip - Tips offer shortcuts and hints on getting the task done.


Caution - Cautions explain roadblocks you might encounter when you work with Perl and tell you how to avoid them.

New terms are emphasized by being placed in bold for your easy reference.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Customer Reviews

Average Rating 4
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted September 16, 2005

    study the chapter on hash

    [A review of the 3RD EDITION 2005.] Pierce gives an updated introduction for Perl, describing the latest version 5.8. Though realistically, if you are new to Perl, you'd be doing fine even if the book didn't reach up to that version. Perl is a very stable, mature language, which is probably what you want. If you already know another language, then many or all of the concepts in this book will be familiar. It just becomes a question of plowing through the chapters, to learn the Perl syntax. In Pierce's presentation, he quickly takes you to what Perl calls a 'hash'. In Java, the corresponding class is a Hashtable. Regardless of terminology, the idea is a very useful one, and if you intend to be a proficient Perl programmer, you need to have this down pat. Earlier material in the text, like scalars and arrays, are pretty trivial to understand and use. The hash table is trickier, but Pierce does a good job in conveying its usage. He avoids the maths theory behind this, but points out that it gives you quick access to a value associated with a key, where this access is not proportional [ie. linear] to the number of keys in the table. He doesn't actually say it's logarithmic, which it is. [For the theory, Cf. Knuth 'Art of Computer Programming' vol 3.] Learn the hash. Experienced programmers [in any language] already know its value. In all of the book, it is the best glimpse into advanced algorithmic coding.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)