You may have already heard of the Perl programming language, perhaps in the context of back-end Web applications. If you ve ever come across the ubiquitous term CGI-Perl , or references to the .pl file suffix in URLs as you surfed the Web, you ve rubbed shoulders with Perl before. Over the years , Perl s popularity has grown with the proliferation of Web applications. But what exactly is Perl for?
Perl is a high-level (yet relatively easy-to-use) programming language that is particularly suited to development of various types of applications, including networking tools, database management applications, system administration utilities, and (of course) Web applications.
As you continue your journey with Linux, you will probably find that you want to take more and more control over the way that your system works. As this happens, you ll also find the features offered by Bash shell scripts increasingly limiting. The Perl programming language will help you get the flexibility you ll crave ”the vast majority of professional Linux systems administrators use Perl as their preferred method for maintaining their systems. They find its power and flexibility invaluable.
The best way to do a job is often to look at how the professionals do it, and follow in their footsteps. But, it s often not easy when you start out. Perl was built for power and flexibility, but not necessarily for immediate comprehensibility or beginner s ease of use (that s what the shell s for).
Nevertheless, this book would not be complete without a glimpse at the world of Perl, so this chapter gives you a few examples of how it can be used to make your life easier. This chapter is rather unlike the others in this book; it s not going to try and teach you key skills that you can take away and use with little or no additional guidance because to give you that much understanding of Perl would require a 300-page chapter. Instead, the intention is to give you a chance to experiment with these examples, and give you a feel for the Perl technology as a whole.
If and when you begin to feel yourself constrained by the limitations of the shell, the information and examples here should enable you to make an informed decision as to whether Perl is the right choice for you.
This chapter looks at the following:
The Comprehensive Perl Archive Network (CPAN)
A number of demonstration Perl script applications (four large examples and half a dozen smaller ones)
Finally, it touches on a larger, more comprehensive, Perl application ”a Web-based systems administration assistant ”which you can use to assist you in your day-to-day administrative tasks . (In fact, this application is further discussed in Chapter 15, and you can download its code from www.wrox.com .)
If you have difficulty getting started, you can supplement the information in this chapter with a good online Perl tutorial. For example, we recommend the Tutorials section of the www.perl.com Web site. At the time of writing, this was at www.perl.com/cs/ user /query/q/6?id_topic=74 , but if this should change, you can access it from the Main Menu, by selecting Resources and scrolling down to the Tutorials option.