Randal L. Schwartz is a two-decade veteran of the software industry. He is skilled in software design, system administration, security, technical writing, and training. Randal has coauthored the "must-have" standards: Programming Perl, Learning Perl, and Learning Perl on Win32 Systems (all from O'Reilly); and Effective Perl Programming(Addison-Wesley). He is also a regular columnist for WebTechniques, Performance-Computing, SysAdmin, and Linux Magazine.He is also a frequent contributor to the Perl newsgroups, and has moderated comp.lang.perl.announce since its inception. His offbeat humor and technical mastery have reached legendary proportions worldwide (but he probably started some of those legends himself). Randal's desire to gfve back to the Perl community inspired him to help create and provide initial funding for The Perllnstitute. He is also a founding board member of the Perl Mongers (perl.org), the worldwide Perl grassroots advocacy organization. Since 1985, Randal has owned and operated Stonehenge Consulting Services, Inc. Randal can be reached for comment at merlyn@stonehenge.com, and welcomes questions on Perl and other related topics.
圖書目錄
preface 1. Introduction Questions and answers Is this the right book for you? why are there so many footnotes? what about the exercises and their answers? what do those numbers mean at the start of the exercise? what if I'm a peri course instructor? what does "peri" stand for? why did larry create perl? why didn't larry just use some other language? is peri easy or hard? how did peri get to be so popular? what's happening with peri now? what's peri really good for? what is peri not good for? how can I get peri? what is cpan? how can i get support for perl? Are there any other kinds of support? what if i find a bug in peri? how do i make a perl program? a simple program what's inside that program? how do i compile my peri program? a whirlwind tour of peri exercises 2. Scalar Data numbers all numbers have the same format internally floating-point literals integer literals nondecimal integer literals numeric operators strings single-quoted string literals double-quoted string literals string operators automatic conversion between numbers and strings perl's built-in warnings scalar variables choosing good variable names scalar assignment binary assignment operators output with print interpolation of scalar variables into strings creating characters by code point operator precedence and associativity comparison operators the if control structure boolean values getting user input the chomp operator the while control structure the undef value the defined function exercises 3. lists and arrays accessing elements of an array special array indices list literals the qw shortcut list assignment the pop and push operators the shift and unshift operators the splice operator interpolating arrays into strings the foreach control structure perl's favorite default the reverse operator the sort operator the each operator scalar and list context using list-producing expressions in scalar context using scalar-producing expressions in list context forcing scalar context stdin in list context exercises 4. subroutines defining a subroutine invoking a subroutine return values arguments private variables in subroutines variable-length parameter lists a better max routine empty parameter lists notes on lexical (my) variables the use strict pragma the return operator omitting the ampersand non-scalar return values persistent, private variables exercises 5. input and output input from standard input input from the diamond operator the invocation arguments output to standard output formatted output with printf arrays and printf filehandles opening a filehandle binmoding filehandles bad filehandles closing a filehandle fatal errors with die warning messages with warn automatically die-ing using filehandles changing the default output filehandle reopening a standard filehandle output with say filehandles in a scalar exercises 6. hashes what is a hash? why use a hash? hash element access the hash as a whole hash assignment the big arrow hash functions the keys and values functions the each function typical use of a hash the exists function the delete function hash element interpolation the %env hash exercises 7. In the world of regular expressions what are regular expressions? using simple patterns unicode properties about metacharacters simple quantifiers grouping in patterns alternatives character classes character class shortcuts negating the shortcuts exercises 8. Matching with regular expressions matches with m// match modifiers case-insensitive matching with/i matching any character with/s adding whitespace with/x combining option modifiers choosing a character interpretation other options anchors word anchors the binding operator =~ interpolating into patterns the match variables the persistence of captures noncapturing parentheses named captures the automatic match variables general quantifiers precedence examples of precedence and there's more a pattern test program exercises 9. processing text with regular expressions substitutions with s/// global replacements with/g different delimiters substitution modifiers the binding operator nondestructive substitutions case shifting the split operator the join function m//in list context more powerful regular expressions nongreedy quantifiers matching multiple-line text updating many files in-place editing from the command line exercises 10. more control structures the unless control structure the else clause with unless the until control structure expression modifiers the naked block control structure the elsif clause autoincrement and autodecrement the value of autoincrement the for control structure the secret connection between foreach and for loop controls the last operator the next operator the redo operator labeled blocks the conditional operator ? logical operators the value of a short circuit operator the defined-or operator control structures using partial-evaluation operators exercises 11. peri modules finding modules installing modules using your own directories using simple modules the file::basename module using only some functions from a module the file::spec module path::class cgi.pm databases and dbi dates and times exercises 12. file tests file test operators testing several attributes of the same file stacked file test operators the stat and lstat functions the localtime function bitwise operators using bitstrings exercises 13. directory operations moving around the directory tree globbing an alternate syntax for globbing directory handles recursive directory listing manipulating files and directories removing files renaming files links and files making and removing directories modifying permissions changing ownership changing timestamps exercises 14. strings and sorting finding a substring with index manipulating a substring with substr formatting data with sprintf using sprintf with "money numbers" interpreting non-decimal numerals advanced sorting sorting a hash by value sorting by multiple keys exercises 15. smart matching and given-when the smart match operator smart match precedence the given statement dumb matching using when with many items exercises 16. process management the system function avoiding the shell the environment variables the exec function using backquotes to capture output using backquotes in a list context external processes with ipc::system::simple processes as filehandles getting down and dirty with fork sending and receiving signals exercises 17. some advanced peri techniques slices array slice hash slice trapping errors using eval more advanced error handling autodie picking items from a list with grep transforming items from a list with map fancier list utilities exercises a. exercise answers b. beyond the llama c. a unicode primer index