Perl Cookbook: Solutions & Examples for Perl Programmers
C**E
Should be your second PERL book after "Learning PERL"
Your first book on PERL should be "Learning PERL", now in its second edition. It takes you through the basics of PERL in a crystal clear fashion with lots of explanations, exercises, and examples. This should be your second book after you've learned to speak basic PERL. When you want to know the most efficient way to approach specific problems, no other book beats it. A concurrent purchase should be Programming PERL. That book is the definitive book on the language, but you could no more learn to program in PERL from that book than you could learn to speak English by using a dictionary as your textbook.Spread over five chapters, the first portion of this book addresses Perl's basic data types. Chapter 1 covers matters like accessing substrings, expanding function calls in strings, and parsing comma-separated data. It also covers Unicode strings. Chapter 2 tackles oddities of floating-point representation, placing commas in numbers, and pseudo-random numbers. Chapter 3 demonstrates conversions between numeric and string date formats and using timers. Chapter 4 covers everything relating to list and array manipulation, including finding unique elements in a list, efficiently sorting lists, and randomizing them. Chapter 5 concludes the section on basics with a demonstration of the most useful data type, the associative array. The chapter shows how to access a hash in insertion order, how to sort a hash by value, how to have multiple values per key, and how to have an immutable hash.Chapter 6, includes recipes for converting a shell wildcard into a pattern, matching letters or words, matching multiple lines, avoiding greediness, matching nested or recursive patterns, and matching strings that are close to but not exactly what you're looking for. Although this chapter is one of the longest in the book, it could easily have been longer still since every chapter contains uses of regular expressions. It's part of what makes Perl the language that it is.The next three chapters cover the filesystem. Chapter 7 shows recipes pertaining to opening files, locking them for concurrent access, modifying them in place, and storing filehandles in variables. Chapter 8 discusses storing filehandles in variables, managing temporary files, watching the end of a growing file, reading a particular line from a file, handling alternative character encodings like Unicode and Microsoft character sets, and random access binary I/O. Finally, in Chapter 9 there are techniques to copy, move, or delete a file, manipulate a file's timestamps, and recursively process all files in a directory.Chapter 10 through Chapter 13 focus on making your program flexible and powerful. Chapter 10 includes recipes on creating persistent local variables, passing parameters by reference, calling functions indirectly, crafting a switch statement, and handling exceptions. Chapter 11 is about data structures. Here basic manipulation of references to data and functions are demonstrated. Later recipes show how to create elaborate data structures and how to save and restore these structures from permanent storage. Chapter 12, concerns breaking up your program into separate files. The chapter discusses how to make variables and functions private to a module, customize warnings for modules, replace built-ins, trap errors loading missing modules, and use the h2ph and h2xs tools to interact with C and C++ code. Lastly, Chapter 13, covers the fundamentals of building your own object-based module to create user-defined types, complete with constructors, destructors, and inheritance. Other recipes show examples of circular data structures, operator overloading, and tied data types.The next two chapters are about interfaces: one to databases and the other to users. Chapter 14 includes techniques for manipulating DBM files and querying and updating databases with SQL and the DBI module. Chapter 15 covers topics such as clearing the screen, processing command-line switches, single-character input, moving the cursor using termcap and curses, thumbnailing images, and graphing data.The last portion of the book is devoted to interacting with other programs and services. Chapter 16 is about running other programs and collecting their output, handling zombie processes, named pipes, signal management, and sharing variables between running programs. Chapter 17 shows how to establish stream connections or use datagrams to create low-level networking applications for client-server programming. Chapter 18 is about higher-level protocols such as mail, FTP, Usenet news, XML-RPC, and SOAP. Chapter 19, contains recipes for processing web forms, trapping their errors, avoiding shell escapes for security, managing cookies, shopping cart techniques, and saving forms to files or pipes. Chapter 20, covers non-interactive uses of the Web, such as fetching web pages, automating form submissions in a script, extracting URLs from a web page, removing HTML tags, finding fresh or stale links, and parsing HTML. Chapter 21 introduces mod_perl, the Perl interpreter embedded in Apache. It covers fetching form parameters, issuing redirections, customizing Apache's logging, handling authentication, and advanced templating with Mason and the Template Toolkit. Finally, Chapter 22 is about ubiquitous data format XML and includes recipes such as validating XML, parsing XML into events and trees, and transforming XML into other formats.
A**N
A model for technical books
The first _Perl Cookbook_ was great. This one is fantastic.When a programming language, operating system, or the like undergoes significant changes, many publishers of technical books seem to have a policy of making the bare minimum of changes to the current edition of their book on the subject and then publishing it as a whole new edition, thicker and with a higher price tag. O'Reilly, by and large, isn't like that; a new edition of any of their books is more often than not a substantial reworking.In this mode, the 1st edition of the _Perl Cookbook_ was obviously intended as a companion volume to _Programming Perl_; but the present (2nd) edition could stand alone as both a reference manual to the language in general and a source of ideas and working code to be adapted to almost any project. Most everything in _Programming Perl_ is here too, but described differently by the different authors, in a way that I find often makes more sense. For example, the discussion of OOP in Perl (Chapter 13) is much more straightforward than the treatment of the subject in _Programming Perl_ for a programmer who already has significant experience with another object-oriented language (in my case, C++).Bottom line: combined with the embarrassment of riches online at[...], this book should give the intermediate- to experienced-level programmer all they could ever need to write great Perl code.
M**J
How I learned Perl
A good many years ago I was assigned a relatively simple programming job- modify an application front-end written in C for a university so that it could be used at our school. The more I looked at it, the more I realized it would be simpler to just rewrite it from scratch, and the more I looked into rewriting it, the more it became apparent that it would be faster and simpler to learn Perl and write it in Perl than to try and do it on our system in C. I looked around for a good Perl reference, and this one came to hand.The quickest way to learn how to program in a new language and environment is to study examples of good programming practice, and that's what the Perl Cookbook provides. Everything I needed to do- parsing input, pattern matching, console I/O, invoking applications and collecting return codes- was all here, along with examples of the way Perl programmers really work. I learned how to use &_, both explicitly and implicitly, and how to simplify input into a simple "while (<STDIN>)"- in short, how to write Perl like a pro.
S**E
This like the Perl Black Book
Man! This like the Perl Black Book, has continuous examples that keep you typing away and repeatedly so that you see different angles of each Perl features, such as different ways of writing out arrays, subroutines, etc...
B**H
Wide spread Range of Programming Tasks
This book definitely helps you to attain the results for your Projects faster and in a more efficient way.It recommends you useful Packages and shows you how to use them in your Projects.For me it helped me very much to realize 2 Projects with very good Results while I am completely new to the Perl Programming Language.What I was missing are new Programming Technologies as JSON. Perl already offers support for JSON but it is not covered yet in this Edition. So certainly this Book will need a new update with new Tools that the very active Community has brought up for new Technologies.
B**N
Best...Perl book.... ever
Most O'Reilly Perl titles imply you'll learn something useful. Only Learning Perl and the Perl Cookbook fully come through in that regard.The Perl Cookbook features some very practical solutions to some very practical problems (in Perl).I find myself coming back to this one again and again - more so than Learning Perl, Programming Perl, Programming the Perl DBI, or Perl Best Practices. This is The One. The book to use to learn the Right Way to perform quite a large number of useful functions or tasks in Perl.
M**G
A very useful textbook for advanced Perl
This is a very useful textbook for advanced Perl. It is somewhat advanced for a beginner in Perl, beginners would be better off with a beginner book such as Programming Perl.I'm working through the section on object orientation. It isn't as clear as it could be, but I have managed to create my own class module. The section on references is much clearer.
M**O
Buenas recetas para programar en Perl
Soy desarrollador principalmente de Java back-end, pero estoy usando Perl para scripts de mantenimiento y prototipos. Es mucho más fácil hacer este tipo de cosas en un lenguaje de alto nivel como Perl, Python o Ruby. Perl me gusta porque lo encuentras en cualquier servidor y tiene muy buen soporte con CPAN. Este libro me ha ayudado a encontrar maneras de solucionar algunos problemas ya que los ejemplos vienen muy bien explicados.La única razón por la que no le doy cinco estrellas es que algunos ejemplos no utilizan Perl moderno, con strict y warnings.
A**.
Utilissimo
Libro di consultazione più che di lettura sistematica, contiene un sacco di informazioni e di ricette pronte che sono vitali per il programmatore Perl. Permette di risparmiare molto tempo per comprendere diversi meccanismi. E' un'opera enciclopedica che non puo' mancare nella biblioteca del programmatore.
A**R
Great Purchase
It's a good book and a good addition to my programming hobby.
C**N
Buon libro
Un must per chi scrive in Perl
Trustpilot
2 months ago
2 weeks ago