Learning Perl (7th Edition)
"Learning Perl (7th Edition)"English | ISBN: 1491954329 | 2016 If you’re just getting started with Perl, this is the book you want—whether you’re a programmer, system administrator, or web hacker. Nicknamed "the Llama" by two generations of users, this bestseller closely follows the popular introSEVENTH EDITIONLearning perlMaking easy Things Easy andHard Things possibleRandal l. schwartz, brian d foy, and Tom phoenixBeijing.Boston. Farnham Sebastopol. Tokyo OREILLYLearning perlby Randal L. Schwartz, brian d foy, and Tom PhoenixCopyright@ 2017 Randal L. Schwartz, brian foy, and Tom Phoenix. All rights reservedPrinted in the united states of americaPublished by o reilly media, Inc, 1005 Gravenstein Highway North, Sebastopol, CA 95472OReilly books may be purchased for educational, business, or sales promotional use Online editions arealsoavailableformosttitles(http://safaribooksonline.com).Formoreinformationcontactourcorporateinstitutionalsalesdepartment800-998-9938orcorporate@oreilly.comEditor: heather schererIndexer: Lucie haskinsProduction Editor: Melanie YarbroughInterior Designer: David FutatoCopyeditor: Jasmine KwitynCover Designer: Karen MontgomeryProofreader: Sonia sarubaIllustrator Rebecca demarestOctober 2016:Seventh editionRevision history for the seventh edition2016-10-05: First releaseSeehttp://oreilly.com/catalog/errata.csp?isbn=9781491954324forreleasedetailsThe O Reilly logo is a registered trademark of O Reilly Media, Inc. Learning Perl, the cover image, andrelated trade dress are trademarks of o reilly media, IncWhile the publisher and the authors have used good faith efforts to ensure that the information andinstructions contained in this work are accurate, the publisher and the authors disclaim all responsibilityfor errors or omissions, including without limitation responsibility for damages resulting from the use ofor reliance on this work. Use of the information and instructions contained in this work is at your ownrisk. If any code samples or other technology this work contains or describes is subject to open sourcelicenses or the intellectual property rights of others, it is your responsibility to ensure that your usethereof complies with such licenses and/or rights978-1-491-95432-4ILSIITable of contentsPreface1. IntroductionQuestions and AnswersIs This the Right Book for You?What about the exercises and Their answers?What If im a perl Course instructoWhat Does" perl Stand for?4Why 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 Now?What's Perl Really Good For?What Is perl not good for?How Can i get perl?What Is CPAN?Is There any Kind of SupportWhat If I Find a bug in perl?How Do I Make a Perl Program?10A Simple program11What's Inside That Program13How Do i Compile my perl Program?15A Whirlwind Tour of perl16Exercise2, Scalar data19Numbers19All Numbers Have the Same Format Internally20Integer Literals20Nondecimal Integer Literals21Floating- Point Literals21Numeric operators22Strings23Single-Quoted String Literals24Double-Quoted String Literals24String OperatorsAutomatic Conversion Between Numbers and Strings26Perls Built-In Warnings27Interpreting Nondecimal Numerals28Scalar variables29Choosing Good Variable NamesScalar assignment31Compound assignment Operators31Output with print32Interpolation of Scalar Variables into Strings32Creating Characters by Code Point33Operator Precedence and associativity34Comparison operators36The if Control Structure37Boolean values37Getting User Input38The chomp operator39The while Control StructureThe undef value40The defined function41Exercises413. Lists and ArraysAccessing Elements of an Array44Special array indices45List literalsThe gw shortcut46List Assignment47The pop and push OperatorsThe shift and unshift Operators49The splice Operator50Interpolating Arrays into Strings51The foreach Control Structure52Perls Favorite Default: S53iv Table of ContentsThe reverse operator53The sort Operator54The each Operator54Scalar and list context55USing List-Producing Expressions in Scalar Context56Using Scalar-Producing Expressions in List Context58Forcing Scalar Context58 in list Context58Exercises594. Subroutines61Defining a Subroutine61Invoking a subroutine62Return valuesArgumentsPrivate Variables in Subroutines66Variable-Length Parameter Lists67A better &max RoutineEmpty Parameter Lists68Notes on Lexical (my) variables69The use strict Pragma70The return Operator71Omitting the ampersand72Nonscalar return valuesPersistent, Private VariablesSubroutine signaturesExercises785. Input and output.…,…,,……,81Input from Standard Input81Input from the Diamond Operator83The Double diamond85The Invocation ArgumentsOutput to Standard Output86Formatted Output with printf89arrays and printf91Filehandles91Opening a Filehandle93Binmoding filehandlesBad Filehandle96Closing a Filehandle97Fatal Errors with die97Table of contentsWarning messages with warn9automatically die-ing99handles100Changing the Default Output Filehandle100Reopening a Standard Filehandle101Output with say102Filehandles in a scalar102Exercises1046. HashesWhat Is a Hash?107Why Use a Hash?109Hash element access110The hash as a Whole111Hash assignment112The Big arrowHash functions114The keys and values functions114The each Function115Typical Use of a hash116The exists Function117The delete functiHash element Interpolation118The %ENV hash118Exercises1197. Reqular expression121Sequences121Practice Some patterns123The Wildcard125Quantifiers126Grouping in Patterns130alternatives133Character clas134Character Class Shortcuts135negating the shortcuts137Unicode Properties137Anchors138Word anch139Exert141Table of ce8. Matching with Reqular ExpressionsMatches with m//143Match modifiers144Case-Insensitive Matching with /i144Matching any Character with /s144Adding whitespace with /x145Combining option modifiers146Choosing a character Interpretation146Beginning and End-of-Line Anchors148Other options149The Binding Operator149The Match Variables150The Persistence of Captures151Noncapturing parentheses152Named Captures153The Automatic Match variables155Precedence157Examples of Precedence158And Theres more158A Pattern Test Program159Exercises1599. Processing Text with Regular Expressions鲁。鲁。·鲁··鲁。。·鲁。鲁。·。鲁鲁,。非161Substitutions with s///161Global Replacements with /g162Different delimiters163Substitution modifiers163The Binding OperatorNondestructive Substitutions163Case shiftin164quoting166The split operatorspl166The join Function168m// in List Context168More Powerful Regular Expressions169nongreedy quantifiers169Fancier word boundaries170Matching Multiple-Line Text2Updating many filesy172In-Place Editing from the Command line174Exercise176Table of Contentsⅶi10. More Control structuresThe unless Control structure177The else Clause with unless178The until Control structure178Statement Modifiers179The Naked Block Control structure180The elsif Clause181Autoincrement and Autodecrement182The Value of autoincrement182The for Control structure183The Secret Connection Between foreach and for185Loop Controls186The last Operator186The next Operator187The redo Operator188Labeled blocks189The Conditional Operator190Logical Operators191The Value of a Short-Circuit Operator192The defined-or Operator193Control Structures Using Partial-Evaluation Operators194Exercises19611. Perl modules197Finding modules197Installing Modules198USing your own directories199Using Simple modules201The File.. Basename Module202Using Only Some Functions from a Modul203The File: Spec Module204Path: clas205Databases and DBl205Dates and Times206Exercises20712. File tests209File Test Operators209Testing Several Attributes of the Same file213Stacked File Test Operators214The stat and lstat Functions216The localtime function217viii Table of Contents
用户评论