首页 > Linux操作系统 > Linux操作系统 > Perl语言入门(第六版)(影印版)


原创 Linux操作系统 作者:china-pub-pb 时间:2012-02-29 15:43:07 0 删除 编辑




  如果刚开始学习 perl 这门语言,那么本书就是你所需要的----不管你是一名程序员,还是系统管理员,抑或是网络黑客。这本书被整整两代 perl用户昵称为"小骆驼书",本书根据作者从 1991 年开始的教学经验积累汇聚而成,多年来十分畅销。此次第六版涵盖了最新的 perl 5.14版本的变化。
   perl 能在绝大多数平台上完成几乎所有任务,不管是简单的修修补补,还是大型完备的网络应用。《perl语言入门》从最基础的开始教起,然后逐渐深入,让你慢慢能够自行编写多至 128 行的程序----如今 90% 的 perl程序差不多都是这般大小。本书每章都包含若干习题,帮助巩固消化刚学到的知识。也许其他书籍只是想着灌输 perl编程的条条框框,但本书不同,我们希望把你培养成一名真正的 perl 程序员。



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
2. scalar data
all numbers have the same format internally
floating-point literals
integer literals
nondecimal integer literals
numeric operators
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
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
4. subroutines
defining a subroutine
invoking a subroutine
return values
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
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
opening a filehandle
binmoding filehandles
bad filehandles
closing a filehandle
fatal errors with die
warning messages with warn
automatically die-lng
using filehandles
changing the default output filehandle
reopening a standard filehandle
output with say
filehandles in a scalar
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
7. in the world of regular expressions
what are regular expressions?
using simple patterns
unicode properties
about metacharacters
simple quantifiers
grouping in patterns
character classes
character class shortcuts
negating the shortcuts
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
word anchors
the binding perator =~
interpolating into patterns
the match variables
the persistence of captures
noncapturing parentheses
named captures
the automatic match variables
general quantifiers
examples of precedence
and there's more
a pattern test program
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
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
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
databases and dbi
dates and times
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
13. directory operations
moving around the directory tree
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
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
15. smart matching and given-when
the smart match operator
smart match precedence
the given statement
dumb matching
using when with many items
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
17. some advanced peri techniques
array slice
hash slice
trapping errors
using eval
more advanced error handling
picking items from a list with grep
transforming items from a list with map
fancier list utilities
a. exercise answers
b. beyond the llama
c. a unicode primer


来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量