|If you've always wanted to master the computer language Perl, now there's a book - Mastering Perl - that tells you how to do just that. |
Of course, there are lots of books about Perl out there, but this one is simple enough to initiate a beginner, yet complex enough to tell you what you need to know.
You will need to have some knowledge of Perl before you read the book, which is more advanced in its Perl skills.
In order to get up to speed before you read Mastering Perl, it's a good idea to read the books Learning Perl and Intermediate Perl.
Sample summaries of chapters
Advanced Regular Expressions
This chapter of the Mastering Perl book discusses Perl's regex engine's advanced features. For example, "qr(" lets you put together a regex for use later and also lets you keep it for reference. The special (?) sequences, lets you enhance my regular expression and also makes it much more elegant and streamlined. The G anchor lets you "tiedown" a next match where the last one stopped, and with the /c flag, you can try several different variations without having to reset the match position if one of them doesn't work.
Secure Programming Techniques
While most programmers swap data, you as a programmer may not want yours handled this way. Because of this, Perl has built in checks to make sure that your data is secure. There's "taint checking," which lets you find parts of your program that might try to "leak" external data resources outside of the program, and also lets you modify them so that they can be trusted before you actually have to use them. Other Perl features also let you program defensively so that scrubbing and checking data isn't all you do. Even though it's a good idea, taint checking doesn't make sure that you're completely secure so that you must keep in mind how secure your environment in general is, just as with any other type of programming.
Got bugs? Perl lets you debug at every level, including by tweaking it from the outside or inserting debugging code right around the area that might give you trouble - and the Mastering Perl book helps you to find out how to do this. You can even debug your program on a machine other than the one you originally ran it on. There's no one right approach when it comes to Perl, and you can use many different approaches at the same time. If existing debugging techniques don't work, you can create your own and make it work based upon exactly what you need to do.
Okay, so you want to improve your program, but first, you have to decide which sections need the most work. Perl lets you do this by profiling it. What are profilers? Debuggers that can specialize; the best part is, you don't have to just use the one already out there. You can make your own if those that exist don't work just right for you.
When you benchmark Perl, you'll need to be aware what's going on and work with a lot of numbers. You'll need to look at your Perl program, but you also have to determine anything that interacts with your program and how it might affect it, such as your operating system, or what Perl interpreter you're using and how you put it together. And while speed is certainly a consideration, you might want to consider other factors, too, such as which of a variety of approaches takes up less bandwidth or how to programs use memory. Because different setups have different benefits and constraints, you'll need to know what's going on before you can work on improving it.
Cleaning up Perl
When you encounter code, you might have several problems that make it difficult to read. Perl can give you the tools to streamline it, make it more elegant, and also figure out how it's working and how it's not. Just by doing a little bit of work, you can read code that's nice and neat instead of having to muddle through what other programmers have done before you.
Configuring Perl Programs
When you put together Perl programs, you don't have to take user-defined data and hardcode it inside your program. You can instead allow different users to specify different runtime options and configurations without ever having to look at source to figure out what's going on. Perl has modules that can handle command line switches, with more on CPAN. Most of CPAN's modules configure nicely with Perl, with some formats having several options. The Mastering Perl book shows you how to use different techniques for different situations, but users won't have to mess with and maybe even break source code to use it.
Detecting and reporting errors
Perl reports errors when something goes wrong, but it does so in a number of different ways. You'll have to know which way is appropriate depending on what it's being used for. Perl can detect errors from other modules and from operating system libraries.
Modules as programs
With Perl, you can create programs that work like modules. The entire module can exist in a single file (excepting third-party modules). Modules are beneficial because you can run it like any other program but you can also test and develop it as you would any module. You get the benefits of both programs and modules when you create programs that work like modules, including installation, dependency handling, and to stability. Because the program is actually a module, parts of it can be used in other programs as well.
You can see excerpts from this book accessing the page: Mastering Perl where you can see free preview of the "Mastering Perl" 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 to Perl Books
Hit the Alarm Clock!