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

Programming_Perl_4th_Edition.pdf

上传者: 2020-06-03 05:33:44上传 PDF文件 15.67MB 热度 17次
FOURTHEDITION ProgrammingPerl TomChristiansen,briandfoyGLarryWall withJonOrwant OREILLY° Beijing·Cambridge.Farnham·Kon:Sebastopol·Tokyo Programmingperl,Fourthedition byTomChristiansen,briandfoylarryWall,withJonOrwant Copyrighto2012TomChristiansen,briandfoy,LarryWall,andJonOrwant.Allrightsreserved PrintedintheUnitedStatesofAmerica PublishedbyOreillymedia,InC,1005GravensteinHighwayNorth,Sebastopol,CA95472 Oreillybooksmaybepurchasedforeducationalbusiness,orsalespromotionaluse.Online editionsarealsoavailableformosttitles(http://my.safaribooksonline.com).Formoreinformation contactourcorporate/institutionalsalesdepartment(800)998-9938orcorporate@oreilly.com Editor:AndyOram CoverDesigner:KarenMontgomery ProductionEditor:HollyBauer InteriorDesignerDavidFutato Proofreader:MarloweShaeffe Illustrator:Robertromano Indexer:Luciehaskins anuary199 Firstedition September1996:Secondedition July2000 Thirdediti February2012:FourthEdition RevisionHistoryfortheFourthEdition: 2011-02-13Firstrelease Seehttp:/oreilly.com/catalog/errata.cspisbn=9780596004927forreleasedetails NutshellHandbook,theNutshellHandbooklogo,andtheO'reillylogoareregisteredtrademarksof O'ReillyMedia,InC.ProgrammingPerl,theimageofadromedarycamel,andrelatedtradedressare trademarksofO'ReillyMedia,Inc Manyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimed trademarks.Wherethosedesignationsappearinthisbook,andOReillyMedia,Inc,wasawareofa trademarkclaim,thedesignationshavebeenprintedincapsorinitialcaps Whileeveryprecautionhasbeentakeninthepreparationofthisbook,thepublisherandauthors assumenoresponsibilityforerrorsoromissions,orfordamagesresultingfromtheuseofthe informationcontainedherein ISBN:978-0-596-004927 1329160875 Tableofcontents Preface Part.overview 1.Anoverviewofperl GettingStarted Naturalandartificiallanguages 4 Variablesyntax AnAverageexample Howtodoit 20 Filehandles 21 perators 24 SomeBinaryarithmeticOperators StringOperators AssignmentOperators 26 UnaryArithmeticOperators 28 Logicaloperato Somenumericandstringcomparisonoperators 30 Somefiletestoperators Controlstructures 31 WhatIstruth? ThegivenandwhenStatements 34 copingConstructs Regularexpressions Quantifiers 43 Minimalmatching 44 NailingThingsDown B ackreferences ListProcessing WhatYoudontKnowWontHurtYou(much) 49 PartI.TheGoryDetails 2,Bitsandpieces 53 Atoms 54 Built-inDataTypes 56 Variables ames 60 NameLookups Numericliterals Stringliterals 67 PickYourOwnQuotes 70 OrLeaveOutthequotesentirely Interpolatingarrayvalues lere”Documents Versionliterals OtherLiteraltokens Context Scalarandlistcontext 76 Booleancontext 78 Voidcontext InterpolativeContext Listvaluesandarrays Listassignment Arraylength 83 Hashes 84 TypeglobsandFilehandles 86 InputOperators 87 CommandInput(Backtick)Operator Lineinput(angle)operator 88 Filenameglobbingoperator 91 3.UnaryandBinaryoperators...... TermsandListOperators(leftward 97 ThearrowOperator 99 Autoincrementandautodecrement 100 ivTableofContents Exponentiation IdeographicUnaryOperators BindingOperators 103 Multiplicativeoperators 104 AdditiveOperators 05 ShiftOperators 105 NamedUnaryandFileTestOperators 106 Relationaloperators 111 EqualityOperators SmartmatchOperator Smartmatchingofob Bitwiseoperators 118 C-Stylelogical(Short-Circuit)Operators Rangeoperators 120 Conditionaloperator Assignmentoperators 125 Commaoperators 126 ListOperatorsrightward 127 ogicaland,or,not,andxor 127 COperatorsMissingfromPerl 128 4.Statementsanddeclarations 鲁···鲁鲁··鲁鲁 129 Simplestatements 130 CompoundStatements 131 ifandunlessstatements ThegivenStatement 133 ThewhenStatementandmodifier 137 Loopstatements 139 whileanduntilstatements 139 Three-PartLoops 140 oreachLoops 142 LoopControl 144 Bareblocksasloops LoopyTopicalizers 149 ThegotoOperator PaleolithicPerlcaseStructures 150 TheEllipsisStatement 152 Globaldeclarations 153 Scopeddeclarations 155 ScopedVariabledeclarations 156 TableofContentsv LexicallyScopedVariables:my PersistentLexicallyscopedvariables:state 160 LexicallyscopedglobalDeclarations:our 161 Dynamicallyscopedvariables:local 162 .as 164 Controllingwarnings 165 ControllingtheUseofglobals 165 5.PatternMatching TheRegularExpressionBestiary 168 Pattern-MatchingOperators 171 Patternmodifiers 175 Them//Operator(Matching) 181 Thes///Operator(Substitution) 184 Thetr///Operator(transliteration) 189 Metacharactersandmetasymbols 192 Metasymboltables 193 SpecificCharacters 99 Wildcardmetasymbols 200 CharacterClasses 202 BracketedCharacterClasses 202 ClassicPerlCharacterclassshortcuts 204 CharacterProperties 207 POSIX-StyleCharacterClasses 210 Quantifiers 214 Positions 217 Beginnings:The\AandAssertions 218 Endings:The g le\z,\z,andsassertions 218 Boundaries:ThebandBassertions 219 ProgressiveMatching 21 WhereYouLeftOff:The\GAssertion 220 Groupingandcapturing 221 capturing 221 routing loutCapturing 229 ScopedPatternModifiers 230 Alternation 231 Stayingincontrol 232 LettingperldotheWork g 233 VariableInterpolation 234 TheregexCompiler 239 ITableofContents TheLittleEngineThat/Could(nit)? 241 FancyPatterns 247 Lookaroundassertions 247 Possessivegroups 249 ProgrammaticPatterns 51 Recursivepatterns 260 Grammaticalpatterns 262 DefiningYourOwnAssertions 270 Alternateengines 271 6.Unicode 275 Show.donttell 280 GettingatUnicodeData 282 TheEncodemodule 285 ACaseofmistakenIdentity 287 Graphemesandnormalization 290 ComparingandSortingUnicodeText 297 Usingtheucawithperlssort 303 ocaleSorting 305 Moregoodies 306 CustomRegexboundaries 308 Buildingcharacter 309 References 313 Subroutines 315 Syntax 315 Semantics 317 TrickswithParameterLists 318 ErrorIndications 320 ScopingIssues 321 Passingreferences 324 Prototypes 326 InliningConstantFunctions 331 CarewithPrototypes 332 PrototypesofBuilt-inFunctions 333 Subroutinettributes 335 ThemethodAttribute 335 Thelvalueattribute 336 Tableofcontents|ⅶi 8.References∴, 339 Whatisareference? 339 CreatingReferences 342 TheBackslashOperator 342 Anonymousdata 342 ObjectConstructors 345 Handlereferences 346 SymbolTablereferences 347 ImplicitCreationofReferences 348 UsingHardReferences 348 Usingavariableasavariablename 348 UsingaBLockAsavariablename 349 UsingthearrowOperator 350 Usingobjectmethods 352 Pseudohashes 352 OtherTricksYouCanDowithHardReferences Closures 355 Symbolicreferences 359 Braces,Brackets,andQuoting 360 ReferencesdontWorkashashKey 361 GarbageCollection,CircularReferences,andWeakReferences362 9.Datastructures 365 Arraysofarrays 365 CreatingandAccessingatwo-Dimensionalarray 366 GrowingYourOwn 366 AccessandPrinting 368 Slices 370 Commonmistakes 371 Hashesofarrays Compositionofahashofarrays 3 Generationofahashofarrays 374 AccessandPrintingofahashofarrays 375 Arraysofhashes 376 Compositionofanarrayofhashes 376 Generationofanarrayofhashes 377 AccessandPrintingofanarrayofhashes 377 Hashesofhashes 378 Compositionofahashofhashes 378 Generationofahashofhashes 37 ⅶiiTableofContents
用户评论