Perl Cookbook(第二版,影印版)
Tom Christiansen, Nathan Torkington
出版时间:2011年03月
页数:976
《Perl Cookbook》汇集了实践中经常遇到的各式难题及解决方案,任何一位使用 Perl编程的人都可以通过书中给出的实际代码范例,快速解决手上的难题。《Perl Cookbook》 第一版于 1998年出版,一经推出,便迅速赢得各方赞誉。不光在 Perl领域它是最棒的一本书,对于其他编程语言来说,放之四海而皆准的编程思想一样使它成为一本难能可贵的好书。
从《Perl Cookbook》开始,介绍编程的图书又多了一种崭新的编写方式:不单是搜集奇技淫巧,而是进一步通过实际问题和案例讲述各种编程问题的思考方式和解决办法。
这次第二版《Perl Cookbook》不仅增订了一些Perl新特性,还补充了许多自第一版以来出现的各式新技术。除了全新的两章外,原先的大部分章节也都做了增补。总共新增的有80条技巧,改进了超100多条旧技巧,涵盖各式新模块和技术。
作为新版,本书沿袭了《Perl Cookbook》第一版中的内容,包括对数据的处理(字符串、数字、日期、数组以及哈希表)、文件I/O、正则表达式、模块、引用、对象、数据结构、信号处理、数据库处理、图形应用、进程间通信、安全性、网络编程、CGI和 LWP等诸多方面。除此以外,新版还包括:
· 在Perl里面对Unicode字符的处理,特别是对字符串的操作、对正则表达式的处理以及文件I/O的使用
· 专门就以mod_perl编程新写了一章,mod_perl是一个将Perl嵌入到Apache服务器内部工作的模块,能极大提高普通CGI程序的加载和运行速度
· 新增并补充了若干技巧,介绍新加入到Perl核心发布的默认模块的使用
· 新增了一章介绍XML的处理,作为全世界用于表示和交换数据文档的标准,XML以其规范统一的格式,精准灵活的语义,让不同形式间的数据信息有了互通的可能
《Perl Cookbook》已经成为迄今为止最棒的一本有关Perl的著作了。它用最直观的方式教人如何编程:先是介绍专家如何解决问题,进而辨析为何采取这种策略。实际上,《Perl Cookbook》并不仅仅是一本介绍Perl编程语言的书,它更是一本教你如何用 Perl 进行编程实践的书。

  1. Foreword
  2. Preface
  3. 1. Strings
  4. 1.1 Accessing Substrings
  5. 1.2 Establishing a Default Value
  6. 1.3 Exchanging Values Without Using Temporary Variables
  7. 1.4 Converting Between Characters and Values
  8. 1.5 Using Named Unicode Characters
  9. 1.6 Processing a String One Character at a Time
  10. 1.7 Reversing a String by Word or Character
  11. 1.8 Treating Unicode Combined Characters as Single Characters
  12. 1.9 Canonicalizing Strings with Unicode Combined Characters
  13. 1.10 Treating a Unicode String as Octets
  14. 1.11 Expanding and Compressing Tabs
  15. 1.12 Expanding Variables in User Input
  16. 1.13 Controlling Case
  17. 1.14 Properly Capitalizing a Title or Headline
  18. 1.15 Interpolating Functions and Expressions Within Strings
  19. 1.16 Indenting Here Documents
  20. 1.17 Reformatting Paragraphs
  21. 1.18 Escaping Characters
  22. 1.19 Trimming Blanks from the Ends of a String
  23. 1.20 Parsing Comma-Separated Data
  24. 1.21 Constant Variables
  25. 1.22 Soundex Matching
  26. 1.23 Program: fixstyle
  27. 1.24 Program: psgrep
  28. 2. Numbers
  29. 2.1 Checking Whether a String Is a Valid Number
  30. 2.2 Rounding Floating-Point Numbers
  31. 2.3 Comparing Floating-Point Numbers
  32. 2.4 Operating on a Series of Integers
  33. 2.5 Working with Roman Numerals
  34. 2.6 Generating Random Numbers
  35. 2.7 Generating Repeatable Random Number Sequences
  36. 2.8 Making Numbers Even More Random
  37. 2.9 Generating Biased Random Numbers
  38. 2.10 Doing Trigonometry in Degrees, Not Radians
  39. 2.11 Calculating More Trigonometric Functions
  40. 2.12 Taking Logarithms
  41. 2.13 Multiplying Matrices
  42. 2.14 Using Complex Numbers
  43. 2.15 Converting Binary, Octal, and Hexadecimal Numbers
  44. 2.16 Putting Commas in Numbers
  45. 2.17 Printing Correct Plurals
  46. 2.18 Program: Calculating Prime Factors
  47. 3. Dates and Times
  48. 3.1 Finding Today’s Date
  49. 3.2 Converting DMYHMS to Epoch Seconds
  50. 3.3 Converting Epoch Seconds to DMYHMS
  51. 3.4 Adding to or Subtracting from a Date
  52. 3.5 Difference of Two Dates
  53. 3.6 Day in a Week/Month/Year or Week Number
  54. 3.7 Parsing Dates and Times from Strings
  55. 3.8 Printing a Date
  56. 3.9 High-Resolution Timers
  57. 3.10 Short Sleeps
  58. 3.11 Program: hopdelta
  59. 4. Arrays
  60. 4.1 Specifying a List 4.2 Printing a List with Commas
  61. 4.3 Changing Array Size
  62. 4.4 Implementing a Sparse Array
  63. 4.5 Iterating Over an Array
  64. 4.6 Iterating Over an Array by Reference
  65. 4.7 Extracting Unique Elements from a List
  66. 4.8 Finding Elements in One Array but Not Another
  67. 4.9 Computing Union, Intersection, or Difference of Unique Lists
  68. 4.10 Appending One Array to Another
  69. 4.11 Reversing an Array
  70. 4.12 Processing Multiple Elements of an Array
  71. 4.13 Finding the First List Element That Passes a Test
  72. 4.14 Finding All Elements in an Array Matching Certain Criteria
  73. 4.15 Sorting an Array Numerically
  74. 4.16 Sorting a List by Computable Field
  75. 4.17 Implementing a Circular List
  76. 4.18 Randomizing an Array
  77. 4.19 Program: words
  78. 4.20 Program: permute
  79. 5. Hashes
  80. 5.1 Adding an Element to a Hash
  81. 5.2 Testing for the Presence of a Key in a Hash
  82. 5.3 Creating a Hash with Immutable Keys or Values
  83. 5.4 Deleting from a Hash
  84. 5.5 Traversing a Hash
  85. 5.6 Printing a Hash
  86. 5.7 Retrieving from a Hash in Insertion Order
  87. 5.8 Hashes with Multiple Values per Key
  88. 5.9 Inverting a Hash
  89. 5.10 Sorting a Hash
  90. 5.11 Merging Hashes
  91. 5.12 Finding Common or Different Keys in Two Hashes
  92. 5.13 Hashing References
  93. 5.14 Presizing a Hash
  94. 5.15 Finding the Most Common Anything
  95. 5.16 Representing Relationships Between Data
  96. 5.17 Program: dutree
  97. 6. Pattern Matching
  98. 6.1 Copying and Substituting Simultaneously
  99. 6.2 Matching Letters
  100. 6.3 Matching Words
  101. 6.4 Commenting Regular Expressions
  102. 6.5 Finding the Nth Occurrence of a Match
  103. 6.6 Matching Within Multiple Lines
  104. 6.7 Reading Records with a Separator
  105. 6.8 Extracting a Range of Lines
  106. 6.9 Matching Shell Globs as Regular Expressions
  107. 6.10 Speeding Up Interpolated Matches
  108. 6.11 Testing for a Valid Pattern
  109. 6.12 Honoring Locale Settings in Regular Expressions
  110. 6.13 Approximate Matching
  111. 6.14 Matching from Where the Last Pattern Left Off
  112. 6.15 Greedy and Non-Greedy Matches
  113. 6.16 Detecting Doubled Words
  114. 6.17 Matching Nested Patterns
  115. 6.18 Expressing AND, OR, and NOT in a Single Pattern
  116. 6.19 Matching a Valid Mail Address
  117. 6.20 Matching Abbreviations
  118. 6.21 Program: urlify
  119. 6.22 Program: tcgrep
  120. 6.23 Regular Expression Grab Bag
  121. 7. File Access
  122. 7.1 Opening a File
  123. 7.2 Opening Files with Unusual Filenames
  124. 7.3 Expanding Tildes in Filenames
  125. 7.4 Making Perl Report Filenames in Error Messages
  126. 7.5 Storing Filehandles into Variables
  127. 7.6 Writing a Subroutine That Takes Filehandles as Built-ins Do
  128. 7.7 Caching Open Output Filehandles
  129. 7.8 Printing to Many Filehandles Simultaneously
  130. 7.9 Opening and Closing File Descriptors by Number
  131. 7.10 Copying Filehandles
  132. 7.11 Creating Temporary Files
  133. 7.12 Storing a File Inside Your Program Text
  134. 7.13 Storing Multiple Files in the DATA Area
  135. 7.14 Writing a Unix-Style 7.15 Modifying a File in Place with a Temporary File
  136. 7.16 Modifying a File in Place with the -i Switch
  137. 7.17 Modifying a File in Place Without a Temporary File
  138. 7.18 Locking a File
  139. 7.19 Flushing Output
  140. 7.20 Doing Non-Blocking I/O
  141. 7.21 Determining the Number of Unread Bytes
  142. 7.22 Reading from Many Filehandles Without Blocking
  143. 7.23 Reading an Entire Line Without Blocking
  144. 7.24 Program: netlock
  145. 7.25 Program: lockarea
  146. 8. File Contents
  147. 8.1 Reading Lines with Continuation Characters
  148. 8.2 Counting Lines (or Paragraphs or Records) in a File
  149. 8.3 Processing Every Word in a File
  150. 8.4 Reading a File Backward by Line or Paragraph
  151. 8.5 Trailing a Growing File
  152. 8.6 Picking a Random Line from a File
  153. 8.7 Randomizing All Lines
  154. 8.8 Reading a Particular Line in a File
  155. 8.9 Processing Variable-Length Text Fields
  156. 8.10 Removing the Last Line of a File
  157. 8.11 Processing Binary Files
  158. 8.12 Using Random-Access I/O
  159. 8.13 Updating a Random-Access File
  160. 8.14 Reading a String from a Binary File
  161. 8.15 Reading Fixed-Length Records
  162. 8.16 Reading Configuration Files
  163. 8.17 Testing a File for Trustworthiness
  164. 8.18 Treating a File as an Array
  165. 8.19 Setting the Default I/O Layers
  166. 8.20 Reading or Writing Unicode fromaFilehandle
  167. 8.21 Converting Microsoft Text Files into Unicode
  168. 8.22 Comparing the Contents of Two Files
  169. 8.23 Pretending a String Is a File
  170. 8.24 Program: tailwtmp
  171. 8.25 Program: tctee
  172. 8.26 Program: laston
  173. 8.27 Program: Flat File Indexes
  174. 9. Directories
  175. 9.1 Getting and Setting Timestamps
  176. 9.2 Deleting a File
  177. 9.3 Copying or Moving a File
  178. 9.4 Recognizing Two Names for the Same File
  179. 9.5 Processing All Files in a Directory
  180. 9.6 Globbing, or Getting a List of Filenames Matching a Pattern
  181. 9.7 Processing All Files in a Directory Recursively
  182. 9.8 Removing a Directory and Its Contents
  183. 9.9 Renaming Files
  184. 9.10 Splitting a Filename into Its Component Parts
  185. 9.11 Working with Symbolic File Permissions Instead of Octal Values
  186. 9.12 Program: symirror
  187. 9.13 Program: lst
  188. 10. Subroutines
  189. 10.1 Accessing Subroutine Arguments
  190. 10.2 Making Variables Private to a Function
  191. 10.3 Creating Persistent Private Variables
  192. 10.4 Determining Current Function Name
  193. 10.5 Passing Arrays and Hashes by Reference
  194. 10.6 Detecting Return Context
  195. 10.7 Passing by Named Parameter
  196. 10.8 Skipping Selected Return Values
  197. 10.9 Returning More Than One Array or Hash
  198. 10.10 Returning Failure
  199. 10.11 Prototyping Functions
  200. 10.12 Handling Exceptions
  201. 10.13 Saving Global Values
  202. 10.14 Redefining a Function
  203. 10.15 Trapping Undefined Function Calls with AUTOLOAD
  204. 10.16 Nesting Subroutines
  205. 10.17 Writing a Switch Statement
  206. 10.18 Program: Sorting Your Mail
  207. 11. References and Records
  208. 11.1 Taking References to Arrays
  209. 11.2 Making Hashes of Arrays
  210. 11.3 Taking References to Hashes
  211. 11.4 Taking References to Functions
  212. 11.5 Taking References to Scalars
  213. 11.6 Creating Arrays of Scalar References
  214. 11.7 Using Closures Instead of Objects
  215. 11.8 Creating References to Methods
  216. 11.9 Constructing Records
  217. 11.10 Reading and Writing Hash Records to Text Files
  218. 11.11 Printing Data Structures
  219. 11.12 Copying Data Structures
  220. 11.13 Storing Data Structures to Disk
  221. 11.14 Transparently Persistent Data Structures
  222. 11.15 Coping with Circular Data Structures Using Weak References
  223. 11.16 Program: Outlines
  224. 11.17 Program: Binary Trees
  225. 12. Packages, Libraries, and Modules
  226. 12.1 Defining a Module’s Interface
  227. 12.2 Trapping Errors in require or use
  228. 12.3 Delaying use Until Runtime
  229. 12.4 Making Variables Private to a Module
  230. 12.5 Making Functions Private to a Module
  231. 12.6 Determining the Caller’s Package
  232. 12.7 Automating Module Cleanup
  233. 12.8 Keeping Your Own Module Directory
  234. 12.9 Preparing a Module for Distribution
  235. 12.10 Speeding Module Loading with SelfLoader
  236. 12.11 Speeding Up Module Loading with Autoloader
  237. 12.12 Overriding Built-in Functions
  238. 12.13 Overriding a Built-in Function in All Packages
  239. 12.14 Reporting Errors and Warnings Like Built-ins
  240. 12.15 Customizing Warnings
  241. 12.16 Referring to Packages Indirectly
  242. 12.17 Using h2ph to Translate C #include Files
  243. 12.18 Using h2xs to Make a Module with C Code
  244. 12.19 Writing Extensions in C with Inline::C
  245. 12.20 Documenting Your Module with Pod
  246. 12.21 Building and Installing a CPAN Module
  247. 12.22 Example: Module Template
  248. 12.23 Program: Finding Versions and Descriptions of Installed Modules
  249. 13. Classes, Objects, and Ties
  250. 13.1 Constructing an Object
  251. 13.2 Destroying an Object
  252. 13.3 Managing Instance Data
  253. 13.4 Managing Class Data
  254. 13.5 Using Classes as Structs
  255. 13.6 Cloning Constructors
  256. 13.7 Copy Constructors
  257. 13.8 Invoking Methods Indirectly
  258. 13.9 Determining Subclass Membership
  259. 13.10 Writing an Inheritable Class
  260. 13.11 Accessing Overridden Methods
  261. 13.12 Generating Attribute Methods Using AUTOLOAD
  262. 13.13 Coping with Circular Data Structures Using Objects
  263. 13.14 Overloading Operators
  264. 13.15 Creating Magic Variables with tie
  265. 14. Database Access
  266. 14.1 Making and Using a DBM File
  267. 14.2 Emptying a DBM File
  268. 14.3 Converting Between DBM Files
  269. 14.4 Merging DBM Files
  270. 14.5 Sorting Large DBM Files
  271. 14.6 Storing Complex Data in a DBM File
  272. 14.7 Persistent Data
  273. 14.8 Saving Query Results to Excel or CSV
  274. 14.9 Executing an SQL Command Using DBI
  275. 14.10 Escaping Quotes
  276. 14.11 Dealing with Database Errors
  277. 14.12 Repeating Queries Efficiently
  278. 14.13 Building Queries Programmatically
  279. 14.14 Finding the Number of Rows Returned by a Query
  280. 14.15 Using Transactions
  281. 14.16 Viewing Data One Page at a Time
  282. 14.17 Querying a CSV File with SQL
  283. 14.18 Using SQL Without a Database Server
  284. 14.19 Program: ggh—Grep Netscape Global History
  285. 15. Interactivity
  286. 15.1 Parsing Program Arguments
  287. 15.2 Testing Whether a Program Is Running Interactively
  288. 15.3 Clearing the Screen
  289. 15.4 Determining Terminal or Window Size
  290. 15.5 Changing Text Color
  291. 15.6 Reading Single Characters fromtheKeyboard
  292. 15.7 Ringing the Terminal Bell
  293. 15.8 Using POSIX termios
  294. 15.9 Checking for Waiting Input
  295. 15.10 Reading Passwords
  296. 15.11 Editing Input
  297. 15.12 Managing the Screen
  298. 15.13 Controlling Another Program with Expect
  299. 15.14 Creating Menus with Tk
  300. 15.15 Creating Dialog Boxes with Tk
  301. 15.16 Responding to Tk Resize Events
  302. 15.17 Removing the DOS Shell Window with Windows Perl/Tk
  303. 15.18 Graphing Data
  304. 15.19 Thumbnailing Images
  305. 15.20 Adding Text to an Image
  306. 15.21 Program: Small termcap Program
  307. 15.22 Program: tkshufflepod
  308. 15.23 Program: graphbox
  309. 16. Process Management and Communication
  310. 16.1 Gathering Output from a Program
  311. 16.2 Running Another 16.3 Replacing the Current Program with a Different One
  312. 16.4 Reading or Writing 16.5 Filtering Your Own Output
  313. 16.6 Preprocessing Input
  314. 16.7 Reading STDERR from a Program
  315. 16.8 Controlling InpAunto ther Program
  316. 16.10 Communicating Between Related Processes
  317. 16.11 Making a Process Look Like a File with Named Pipes
  318. 16.12 Sharing Variables in Different Processes
  319. 16.13 Listing Available Signals
  320. 16.14 Sending a Signal
  321. 16.15 Installing a Signal Handler
  322. 16.16 Temporarily Overriding a Signal Handler
  323. 16.17 Writing a Signal Handler
  324. 16.18 Catching Ctrl-C
  325. 16.19 Avoiding Zombie Processes
  326. 16.20 Blocking Signals
  327. 16.21 Timing Out an Operation
  328. 16.22 Turning Signals into Fatal Errors
  329. 16.23 Program: sigrand
  330. 17. Sockets
  331. 17.1 Writing a TCP Client
  332. 17.2 Writing a TCP Server
  333. 17.3 Communicating over TCP
  334. 17.4 Setting Up a UDP Client
  335. 17.5 Setting Up a UDP Server
  336. 17.6 Using Unix Domain Sockets
  337. 17.7 Identifying the Other End of a Socket
  338. 17.8 Finding Your Own Name and Address
  339. 17.9 Closing a Socket After Forking
  340. 17.10 Writing Bidirectional Clients
  341. 17.11 Forking Servers
  342. 17.12 Pre-Forking Servers
  343. 17.13 Non-Forking Servers
  344. 17.14 Multitasking Server with Threads
  345. 17.15 Writing a Multitasking Server with POE
  346. 17.16 Writing a Multihomed Server
  347. 17.17 Making a Daemon Server
  348. 17.18 Restarting a Server on Demand
  349. 17.19 Managing Multiple Streams of Input
  350. 17.20 Program: backsniff
  351. 17.21 Program: fwdport
  352. 18. Internet Services
  353. 18.1 Simple DNS Lookups
  354. 18.2 Being an FTP Client
  355. 18.3 Sending Mail
  356. 18.4 Reading and Posting Usenet News Messages
  357. 18.5 Reading Mail with POP3
  358. 18.6 Simulating Telnet from a Program
  359. 18.7 Pinging a Machine
  360. 18.8 Accessing an LDAP Server
  361. 18.9 Sending Attachments in Mail
  362. 18.10 Extracting Attachments from Mail
  363. 18.11 Writing an XML-RPC Server
  364. 18.12 Writing an XML-RPC Client
  365. 18.13 Writing a SOAP Server
  366. 18.14 Writing a SOAP Client
  367. 18.15 Program: rfrm
  368. 18.16 Program: expn and vrfy
  369. 19. CGI Programming
  370. 19.1 Writing a CGI Script
  371. 19.2 Redirecting Error Messages
  372. 19.3 Fixing a 500 Server Error
  373. 19.4 Writing a Safe 19.5 Executing Commands Without Shell Escapes
  374. 19.6 Formatting Lists and Tables with HTML Shortcuts
  375. 19.7 Redirecting to a Different Location
  376. 19.8 Debugging the Raw HTTP Exchange
  377. 19.9 Managing Cookies
  378. 19.10 Creating Sticky Widgets
  379. 19.11 Writing a Multiscreen CGI Script
  380. 19.12 Saving a Form to a File or Mail Pipe
  381. 19.13 Program: chemiserie
  382. 20. Web Automation
  383. 20.1 Fetching a URL from a Perl Script
  384. 20.2 Automating Form Submission
  385. 20.3 Extracting URLs
  386. 20.4 Converting ASCII to HTML
  387. 20.5 Converting HTML to ASCII
  388. 20.6 Extracting or Removing HTML Tags
  389. 20.7 Finding Stale Links
  390. 20.8 Finding Fresh Links
  391. 20.9 Using Templates to Generate HTML
  392. 20.10 Mirroring Web Pages
  393. 20.11 Creating a Robot
  394. 20.12 Parsing a Web Server Log File
  395. 20.13 Processing Server Logs
  396. 20.14 Using Cookies
  397. 20.15 Fetching Password-Protected Pages
  398. 20.16 Fetching https:// Web Pages
  399. 20.17 Resuming an HTTP GET
  400. 20.18 Parsing HTML
  401. 20.19 Extracting Table Data
  402. 20.20 Program: htmlsub
  403. 20.21 Program: hrefsub
  404. 21. mod_perl
  405. 21.1 Authenticating
  406. 21.2 Setting Cookies
  407. 21.3 Accessing Cookie Values
  408. 21.4 Redirecting the Browser
  409. 21.5 Interrogating Headers
  410. 21.6 Accessing Form Parameters
  411. 21.7 Receiving Uploaded Files
  412. 21.8 Speeding Up Database Access
  413. 21.9 Customizing Apache’s Logging
  414. 21.10 Transparently Storing Information in URLs
  415. 21.11 Communicating Between mod_perl and PHP
  416. 21.12 Migrating from CGI to mod_perl
  417. 21.13 Sharing Information Between Handlers
  418. 21.14 Reloading Changed Modules
  419. 21.15 Benchmarking a mod_perl Application
  420. 21.16 Templating with HTML::Mason
  421. 21.17 Templating with Template Toolkit
  422. 22. XML
  423. 22.1 Parsing XML into Data Structures
  424. 22.2 Parsing XML into a DOM Tree
  425. 22.3 Parsing XML into SAX Events
  426. 22.4 Making Simple Changes to Elements or Text
  427. 22.5 Validating XML
  428. 22.6 Finding Elements and Text Within an XML Document
  429. 22.7 Processing XML Stylesheet Transformations
  430. 22.8 Processing Files Larger Than Available Memory
  431. 22.9 Reading and Writing RSS Files
  432. 22.10 Writing XML
  433. Index
书名:Perl Cookbook(第二版,影印版)
国内出版社:东南大学出版社
出版时间:2011年03月
页数:976
书号:978-7-5641-2494-6
原版书书名:Perl Cookbook, Second Edition
原版书出版商:O'Reilly Media
Tom Christiansen
 
Tom Christiansen是一位擅长Perl培训和写作的自由职业顾问。为TSR Hobbies (以其“龙与地下城”游戏而闻名)工作多年之后,他又返回大学,在西班牙待了一年,另外5年留在美国,热衷于音乐、语言学和编程,另外还学习了6种不同的语言。Tom最后终于从威斯康星大学-麦迪逊分校拿到了西班牙语和计算机科学的学士学位,另外还拿到计算机科学的硕士学位。接下来5年他在Convex担任一种万事通的角色,从系统管理到工具和内核开发都有涉足,另外还要负责客户支持和培训。Tom还在USENIX协会董事会担任了两届董事。由于有30多年Unix系统编程方面的经验,Tom举办过多场国际研讨会。如今Tom生活在科罗拉多州巨石市上面的丘陵地区,他的夏天总是在远足、骑马、捕鸟、作曲和游戏中度过。
 
 
Nathan Torkington
 
Nathan Torkington has never climbed Mount Kilimanjaro. He adamantly maintains
that he was nowhere near the grassy knoll. He has never mustered superhuman
strength to lift a burning trolleycar to free a trapped child, and is yet to taste human
flesh. Nat has never served as a mercenary in the Congo, line-danced, run away to
join the circus, spent a year with the pygmies, finished the Death By Chocolate, or
been miraculously saved when his cigarillo case stopped the bullet.
Nat is not American, though he is learning the language. He is from Ti Point, New
Zealand. People from Ti Point don’t do these things. They grow up on fishing boats
and say things like ‘‘She’ll be right, mate.’’ Nat did. He works as an editor for
O’Reilly, selects content for the Open Source Convention, is project manager for Perl
6, and sits on the board of The Perl Foundation. He lives in Colorado and New
Zealand with his wife, Jenine, and their children, William and Aurelia. His hobbies
are bluegrass music and Perl.
 
 
The animal featured on the cover of Perl Cookbook, Second Edition is a bighorn
sheep. Bighorn sheep (Ovis canadensis) are wild sheep noted, not surprisingly, for
their large, curved horns. Male bighorns grow to approximately 5 feet long and 40
inches tall to the shoulder and weigh up to 350 pounds. Their horns measure up to
18 inches in circumference and 4 feet long and can weigh up to 30 pounds. Despite
their bulk, bighorns are adept at negotiating mountainous terrains. With their sharp, cloven hooves they can walkon ledges as thin as two inches. They have excellent
eyesight that enables them to locate footholds and to accurately judge distances
between ledges. They can jump as far as 20 feet from ledge to ledge.
Competition for ewes is intense and often leads to fierce battles that can continue for
a full day. During the battle two rams race at each other at speeds of up to 20 miles
an hour, clashing their horns together. The skull of the bighorn sheep is doublelayered
to provide protection from these blows. Horn size is a significant factor in
determining rank, and rams will only fight other rams with an equivalently sized
horn. Mature males usually stay apart from the females and young. In these “bachelor
flocks” the lower-ranking males often play the part of ewes and behave in a
submissive manner toward the dominant males. The dominant male, in turn,
behaves like a courting ram and mounts the lower-ranking male. This behavior is
believed to enable the rams to live together without rankdisputes that might otherwise
drive the lower-ranking males out of the flock.
Bighorns can be found in the Rocky Mountains from Canada to Colorado and in the
desert from California to west Texas and Mexico. They are threatened with extinction
as a result of disease, habitat reduction, and hunting.