Perl 5 by Example: Welcome


Next Chapter







Part I: Basic Perl

01-Getting Your Feet Wet

02-Numeric and String Literals





07-Control Statements


Part II: Intermediate Perl

09-Using Files

10-Regular Expressions

11-Creating Reports

Part III: Advanced Perl

12-Using Special Variables

13-Handling Errors and Signals

14-What Are Objects?

15-Perl Modules

16-Debugging Perl

17-Command line Options

Part IV: Perl and the Internet

18-Using Internet Protocols

19-What is CGI?

20-Form Processing

21-Using Perl with Web Servers

22-Internet Resources


A-Review Questions


C-Function List

D-The Windows Registry

E-What's On the CD?


Welcome to Perl 5 by Example
by David Medinets

Reading Perl 5 by Example is the easiest way to learn Perl! Teach yourself Internet programming and CGI scripting.

Jump right into Perl with Chapter 1, "Getting Your Feet Wet", or read the beginning materials below and the introduction chapter.

Order your own copy!, the earth's largest bookstore with 2.5 million titles available, is selling my Perl 5 by Example at 20% below cover price. If you're interested in a copy of the book, CLICK HERE!.

The online version of this book is being continually updated to fix errata and to add value in other ways. If you have suggestions, please send mail to David Medinets.

This book is based on the learn-by-doing principle because I believe that simply reading about some subjects isn't enough. After all, you don't read about putting together a jigsaw puzzle, you put the puzzle together yourself! Programming is the same way. You must actually run some programs in order to really understand the concepts.

Perl 5 by Example teaches you how to use the Perl programming language by showing examples that demonstrate the concepts being discussed. The examples are designed to give you a chance to experiment-which in turn should clarify the material.

- excerpt from the Introduction


To my wife, Kathryn - David

About the Author

David Medinets has been programming since 1980, when he starting with a TRS-80 Model 1. He still fondly remembers the days when he could cross-wire the keyboard to create funny-looking characters on the display. Since those days, he has spent time debugging Emacs on UNIX machines, working on VAXen, and messing around with DOS microcomputers. David is married to Kathryn and lives in Northwest New Jersey. He runs Eclectic Consulting and has co-authored Special Edition, Using Lotus Notes Release 4 (Que), Special Edition, Using Turbo C++ 4.5 for Windows (Que), Microsoft Office 95 Unleashed (SAMS), and Visual Basic Unleashed (SAMS) among others. David can be reached at


I'd like to thank all of the people at Que for making this book possible. You'll find their names listed on the Credits page so I won't list them all here. Susan Ross Moore deserves special thanks for figuratively watching over my shoulder as I worked. Her comments definitely made this a better book. Al Valvano was instrumental in making sure that everything came together at the proper time.

My wonderful wife deserves some thanks for letting me hang out on the Internet at all hours of the day and night while I did research for this book.

While writing this book, I have gleaned information from many books, articles, and web resources. Where a particular item greatly influenced my thinking, I have given credit in the appropriate section.

Dale Bewley helped to create Chapter 19, "What is CGI?" - Thanks Dale!

And, of course, no Perl author should forget to thank: Larry Wall for creating Perl in the first place; Tom Christiansen for his remarkable contributions to the Perl community; and Randal Schwartz for his Learning Perl book which every Perl programmer seems to have read.

Electronic Book Information

Please send all suggestions and comments about this E-book to We are continually looking for better ways to present informational material. If you are aware of any new book reading technology that you believe is or will become a standard in the future, please let us know.

David Medinets

We'd Like to Hear From You!

As part of our continuing effort to produce books of the highest possible quality, Que would like to hear your comments. To stay competitive, we really want you, as a computer book reader and user, to let us know what you like or dislike most about this book or other Que products.

You can mail comments, ideas, or suggestions for improving future editions to the address below, or send us a fax at (317) 581-4663. For the online inclined, Macmillan Computer Publishing has a forum on CompuServe (type GO QUEBOOKS at any prompt) through which our staff and authors are available for questions and comments. The address of our Internet site is (World Wide Web).

In addition to exploring our forum, please feel free to contact me personally to discuss your opinions of this book: I'm 74671,3710 on CompuServe, and on the Internet.

Thanks in advance - your comments will help us to continue publishing the best books available on computer topics in today's market.

Al Valvano
Acquisitions Editor
Que Corporation
201 W. 103rd Street
Indianapolis, Indiana 46290

Copyright Information

Copyright 1996 by Que Corporation.

All rights reserved. Printed in the United States of America. No part of this book may be used or reproduced in any form or by any means, or stored in a database or retrieval system, without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this book for any purpose other than your own personal use is a violation of United States copyright laws. For information, address Que Corporation, 201 W. 103rd Street, Indianapolis, IN 46290. You may reach Que's direct sales line by calling 1-800-428-5331.

Library of Congress Catalog No.: 96-69960

ISBN: 0-7897-0866-3

This book is sold as is, without warranty of any kind, either express or implied, respecting the contents of this book, including but not limited to implied warranties for the book's quality, performance, merchantability, or fitness for any particular purpose. Neither Que Corporation nor its dealers or distributors shall be liable to the purchaser or any other person or entity with respect to any liability, loss, or damage caused or alleged to be caused directly or indirectly by this book.

98 97 96 6 5 4 3 2 1

Interpretation of the printing code: the rightmost double-digit number is the year of the book's printing; the rightmost single-digit number, the number of the book's printing. For example, a printing code of 96-1 shows that the first printing of the book occurred in 1996.

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Que cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.

Screen reproductions in this book were created using Collage Plus from Inner Media, Inc., Hollis, NH.

NetWare is a registered trademark of Novell, Inc. IBM is a registered trademark of International Business Machines Corporation. Microsoft is a registered trademark and Windows is a trademark of Microsoft Corporation. Apple, AppleTalk, and Macintosh are registered trademarks of Apple Computer, Inc.


President: Roland Elgey
Publisher: Joseph B. Wikert
Director of Marketing Lynn E. Zingraf
Editorial Services Director: Elizabeth Keaffaber
Managing Editor: Sandy Doell
Title Manager: Bryan Gambrel
Project Director Al Valvano
Production Editors: Susan Ross Moore, Matthew B. Cox
Editors: Elizabeth Barrett, Anne Owen, Jeff Riley
Product Marketing Manager Kim Margolius
Assistant Product Marketing Manager Christy M. Miller
Technical Editor(s) Joe Milton
J. David Shinn, CNE-Synergetic Resource Corp.
Technical Support Specialist Nadeem Muhammed
Acquisitions Coordinator Carmen Krikorian
Operations Coordinator Patricia J. Brooks
Editorial Assistant: Andrea Duvall

Top of Page | Sections | Chapters | Copyright