1. 首页
  2. 编程语言
  3. Perl
  4. LearningPerl

LearningPerl

上传者: 2019-05-14 01:31:34上传 PDF文件 7.52MB 热度 20次
Learning perl 第六版,经典Perl小骆驼丛书Learning perlSIXTH EDITIONLearning PerlRandal l. Schwartz, brian d foy, and Tom PhoenixO REILLYBeijing· Cambridge· Farnham·Koln· Sebastopol· TokyoLearning perl sixth Editionby Randal L. Schwartz, brian d foy, and Tom PhoenixCopyright o 2011 Randal L. Schwartz, brian d foy, and Tom Phoenix. All rights reservedPrinted in the United States of americaPublished by O Reilly Media, Inc, 1005 Gravenstein Highway North, Sebastopol, CA 95472O'Reilly books may be purchased for educational, business, or sales promotional use. Online editionsarealsoavailableformosttitles(http://my.safaribooksonline.com).Formoreinformationcontactourcorporate/institutionalsalesdepartment:(800)998-9938orcorporate@oreilly.comEditor: Simon St laurentIndexer: John BickelhauptProduction editor: Kristen beCover designer Karen montgomeryCopyeditor Audrey doyleInterior Designer: David FutatoProofreader: Kiel Van hornIllustrator: Robert roPrinting History:November 1993: First EditionJuly 1997Second editionJuly 2001Third editionJuly 2005Fourth editionJuly 2008Fifth editionJune 2011:Sixth editionNutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks ofO'Reilly Media, Inc. Learning Perl, the image of a llama, and related trade dress are trademarks ofO'Reilly media, IncMany of the designations used by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and O'Reilly Media, Inc, was aware of atrademark claim, the designations have been printed in caps or initial capsWhile every precaution has been taken in the preparation of this book, the publisher and authors assumeno responsibility for errors or omissions, or for damages resulting from the use of the information contained hereinISBN:978-1-449-30358-7ILSI1308077187Table of contentsPreface1. IntroductiQuestions and AnswersIs This the right Book for You?Why Are There So Many Footnotes?What about the Exercises and Their answersWhat Do those numbers mean at the Start of the exercise?What If i'm a perl course instructor?4What does“Perl” Stand for?Why Did Larry Create Perl?Why Didnt Larry Just Use Some Other Language?Is Perl easy or hard?How Did Perl get to Be so popular?What's Happening with Perl now4556778What's Perl Really Good ForWhat is perl not good for?How Can i get perl?What IS CPAN?10How Can I Get Support for perl?10Are There any Other Kinds of SupportWhat If I Find a Bug in Perl?12How Do I Make a Perl ProgramA Simple program13What's Inside That Program?How do I Compile my perl Program?A Whirlwind tour of perlExercises182. Scalar data21umbers21All Numbers Have the Same Format InternallyFloating-Point Literals22Integer literalsNondecimal Integer literalsNumeric OperatorsStrings24Single-Quoted String LiteralsDouble-Quoted String Literals25String Operators26Automatic Conversion Between Numbers and Strings27Perl's built-in warningsScalar variablesChoosing good variable names30Scalar assignment31Binary assignment operators31Output with print3Interpolation of Scalar Variables into StringsCreating Characters by Code Point34Operator Precedence and associativity34Comparison operators36The if Control Structure37Boolean values38Getting User Input39e chomp Operator39The while Control StructureThe undef valuThe defined FunctionExercises423. Lists and arraysAccessing Elements of an arrapecial Array Indic4546The gw sqYhortcutList assignmentThe pop and push Operators49The shift and unshift Operators50The splice operator50Interpolating Arrays into Strings51The foreach Control str53Perl's Favorite Default: S54The reverse Operator54The sort Operator54I Table of ContentsThe each OperatorScalar and list context55Using list-Producing expressions in Scalar Context57Using Scalar-Producing Expressions in List Context58Forcing Scalar Context59 in List contextExercises604. Subroutines∴Defining a Subroutine63evoking a Subroutine64Return values64Arguments66Private variables in subroutines68Variable-Length Parameter Lists6a better &max routineEmpty Parameter ListsNotes on Lexical (my) Variableshe use strict Pragma72The return OperatorOmitting the ampersand74Non-Scalar Return values76Persistent Private variables76Exercises785. Input and output.....81Input from Standard input81Input from the Diamond operator83The Invocation ArgumentsOutput to standard OutputFormatted Output with printfArrays and printfFilehandles91pening a filehandle93Binmoding filehandles95Bad FilehandlesClosing a filehandle96Fatal Errors with dieWarning messages with warnAutomatically die-ing99Using Filehandles100Changing the Default Output Filehandle100Reopening a standard Filehandle101Table of contents|ⅶiOutput with sa102Filehandles in a scalar103Exercises104107What is a hash107Why Use a Hash?109Hash Element access110The Hash as a whole112Hash assignment113The Big arrow114Hash Functions115The keys and values Functions115The each function116ypical Use of a Hash118The exists Function118The delete Fu118Hash Element Interpolation119he %env hashExercises1207. In the World of Regular expressions,121What Are Regular Expressions?Using Simple patterns122Unicode Properties123About metacharacters123Simple quantifiers124Grouping in Patterns125Alternatives127Character Classes128Character class shortcutsNegating the shortcuts131Exercises1318. Matching with reqular Expressions,133Matches with m//133Match modifiers134Case-Insensitive Matching with /134Matching Any Character with /s134Adding Whitespace with /x135Combining Option Modifiers135Choosing a Character Interpretation136Other Options138ⅶ ii Table of Contents
下载地址
用户评论