Sams Teach Yourself Perl in 21 Days.pdf

(2512 KB) Pobierz
Laura Lemay
with revisions by Rafe Colburn
Teach Yourself
Perl
in
21
Days
SECOND EDITION
800 East 96th
St., Indianapolis, Indiana, 46240 USA
Sams Teach Yourself Perl in 21 Days,
Second Edition
Copyright © 2002 by Sams Publishing
All rights reserved. No part of this book shall be reproduced, stored in a
retrieval system, or transmitted by any means, electronic, mechanical, photo-
copying, recording, or otherwise, without written permission from the publish-
er. No patent liability is assumed with respect to the use of the information
contained herein. Although every precaution has been taken in the preparation
of this book, the publisher and author assume no responsibility for errors or
omissions. Neither is any liability assumed for damages resulting from the use
of the information contained herein.
International Standard Book Number: 0-672-32035-5
Library of Congress Catalog Card Number: 00-105848
Printed in the United States of America
First Printing: June 2002
05
04
03
02
4
3
2
1
A
CQUISITIONS
E
DITORS
Mark Taber
Katie Purdum
D
EVELOPMENT
E
DITOR
Scott D. Meyers
M
ANAGING
E
DITOR
Charlotte Clapp
P
ROJECT
E
DITOR
Anthony Lawrence Wesley
Reitz III
P
RODUCTION
E
DITOR
Chip Gardner
I
NDEXER
Erika Millen
T
ECHNICAL
E
DITOR
Jason Pellerin
I
NTERIOR
D
ESIGN
Gary Adair
Trademarks
All terms mentioned in this book that are known to be trademarks or service
marks have been appropriately capitalized. Sams 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.
C
OVER
D
ESIGN
Aren Howell
L
AYOUT
T
ECHNICIANS
Rebecca Harmon
Susan Geiselman
Stacey Richwine-DeRome
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as
possible, but no warranty or fitness is implied. The information provided is on
an “as is” basis. The authors and the publisher shall have neither liability or
responsibility to any person or entity with respect to any loss or damages aris-
ing from the information contained in this book.
Contents at a Glance
Introduction
W
EEK
1
Getting Started
Day 1
2
3
4
5
6
7
An Introduction to Perl
Working with Strings and Numbers (Scalar Data)
More Scalar Data and Operators
Working with Lists and Arrays
Working with Hashes
Conditionals and Loops
Exploring a Few Longer Examples
1
5
7
29
57
85
115
143
175
189
191
215
243
269
299
319
353
379
381
409
437
453
481
523
559
W
EEK
2
Doing More
Day 8
9
10
11
12
13
14
Manipulating Lists and Strings
Pattern Matching with Regular Expressions
Doing More with Regular Expressions
Creating and Using Subroutines
Debugging Perl
Scope, Modules, and Importing Code
Exploring a Few Longer Examples
W
EEK
3
Advanced Perl
Day 15
16
17
18
19
20
21
Working with Files and I/O
Using Perl for CGI Scripting
Managing Files and Directories
Perl and the Operating System
Working with References
Odds and Ends
Exploring a Few Longer Examples
Appendixes
A
B
C
Perl Functions
Installing Perl on a Unix System
Installing Perl for Windows
Index
589
591
629
639
645
Zgłoś jeśli naruszono regulamin