Perl Cookbook, Second Edition
|The Perl Cookbook, by Tom Christiansen and Nat Torkington, is a collection of problems, solutions and practical examples that will be indispensable to anyone who is programming in Perl. |
With hundreds of thoroughly tested Perl "recipes" and thousands of examples to choose from, the Perl programmer will be able to find the solution to a myriad of problems.
The Perl Cookbook has been fully updated to accommodate Perl 5.8, and includes detailed changes for Unicode support, mod_perl, I/O layers and more.
Every chapter has been fully updated, with some almost double in size to the previous edition.
Here is a brief overview of what you can find in the Perl Cookbook by chapter. Readers will see just how comprehensive this book really is.
Chapter one, Strings, covers using strings and substrings. Readers will learn methods of establishing a default value, converting between values and characters, and using Unicode characters. Recipes for controlling case, properly capitalizing a title or headline, expanding and compressing tabs and parsing data are all included here.
Chapter two, Numbers, covers floating-point numbers, integers, Roman numerals and random numbers. Trigonometry, calculating functions and logarithms and multiplying matrices are all addressed in this chapter, as are complex numbers, prime factors and plurals.
Chapter three, Dates and Times, discusses printing dates, finding today's date, and parsing dates and times from strings. Learn how to convert DMYHMS to epoch seconds and vice versa. Users will be able to program a high-resolution timer and short sleeps with the help you'll find here.
Chapter four, Arrays, has topics that discuss how to specify a list in your program, changing an array size, how to implement a sparse array and reversing an array. Iterating arrays, extracting unique elements from a list, and processing multiple elements are just some of the assistance available in this chapter.
In chapter five, Hashes, the book discusses testing for the presence of a key in a hash, adding an element to a hash and creating a hash with immutable values or keys. Other tasks like inverting, sorting or merging hashes, or presizing a hash are explained thoroughly.
Chapter six, Pattern Matching, covers matching letters and words, extracting a range of lines, testing for valid patterns, detecting doubled words and greedy and non-greedy matches. It discusses how to read records with a separator, finding the nth occurrence of a match, and commenting regular expressions. Readers will learn how to honor locale settings in regular expressions, and copy and substitute simultaneously, as well as many other functions with pattern matching.
In chapter seven, File Access, the reader of "Perl Cookbook" will find recipes and programming tips to open files, store file handles into variables, create temporary files and lock files. Flushing output, doing non-blocking I/O and writing a Unix-style filter program are also discussed here.
Chapter eight, File Contents, covers just about anything you need to put in a file. The chapter discusses trailing a growing file, randomizing all lines, processing binary files, testing a file for trustworthiness, and treating a file as an array, among many other topics.
Chapter nine, Directories, covers timestamps, deleting, copying and moving files, processing all files in a directory, renaming files and globbing, otherwise known as getting a list of filenames matching a pattern.
In chapter ten, Subroutines, the reader can explore how to make variables private to a function, create persistent private variables and skipping selected return values. Other topics discussed in this chapter include handling exceptions, saving global values, redefining a function and nesting subroutines.
Chapter eleven, References and Records, covers all sorts of reference functions, scalars, and data structures. It discusses constructing records and closures.
In chapter twelve, Packages, Libraries and Modules, the book discusses module functions like creating a module directory, defining the interface, documenting with a pod, and distribution. It teaches how to override built-in functions, determining a caller's package, and writing extensions in C.
Chapter thirteen, Classes, Objects and Ties, talks about constructing and destroying objects, managing class data and determining subclass memberships. Other topics include invoking methods indirectly, writing an inheritable class and generating attribute methods using Autoload.
In chapter fourteen, Database Access, the "Perl Cookbook" covers many different problems you may encounter when dealing with database files. Transactions, queries, data and CSV files are all discussed in SQL context.
Chapter fifteen, Interactivity, gives solutions for parsing program arguments, clearing the screen, using POSIX termios, reading passwords, editing input, graphing data, thumbnailing images and many other interactive issues.
In chapter sixteen, Process Management and Communication, topics like communicating between related processes, controlling input, output and errors in another program, preprocessing input, gathering output, writing a signal handler and many other related concerns are discussed in depth.
In chapter seventeen, Sockets, the reader is given solutions for setting up a UDP server and client, forking servers, multitasking servers with threads, making a daemon server, managing multiple streams of input, writing TCP servers and clients and many other related issues.
Chapter eighteen, Internet Services, talks about DNS lookups, sending mail, reading mail with POP3, accessing an LDAP server and writing a SOAP server or client, among other internet topics.
In chapter nineteen, CGI Programming, the reader will be treated to recipes and solutions for writing a CGI script, redirecting error messages, fixing a 500 server error, executing commands without shell escapes, and managing cookies. The chapter also discusses how to create sticky widgets, debugging the raw HTTP exchange and how to use HTML shortcuts to format lists and tables.
Chapter twenty, Web Automation, covers such useful web information as extracting URLs, automating forms, finding stale or invalid links, mirroring web pages and more.
In chapter twenty-one, mod_perl, the reader will learn how to utilize Apache, how to set and manage parameters, cookie values and other related topics.
Chapter twenty-two, XML, teaches the reader how to parse XML into data structures, DOM trees and SAX events, as well as other uses for XML.
The Perl Cookbook is an invaluable tool for anyone working with this programming language. It offers assistance for a large amount of common problems programmers face every day.
You can see excerpts from this book accessing the page: Perl Cookbook where you can see free preview of the "Perl Cookbook, Second Edition" or subscribe to it in order to have access at the whole thing.
Related links:Would you like to create your own website like this one?
Learning Perl Fourth Edition
Teach Yourself Perl
Perl Best Practices
Mastering Algorithms with Perl
Beginning Perl for Bioinformatics
Mastering Perl for Bioinformatics
Mastering Regular Expressions, Third Edition
Perl Tk Tutorial
return from Perl Cookbook to Perl Books
Hit the Alarm Clock!