521 522




Linux Unleashed, Third Edition:Perl





-->















Previous
Table of Contents
Next




Converting Programs to Perl
The Perl language is similar to other programming languages that come with Linux in the kinds of things it can do. The most significant of these languages are gawk and sed. The Perl distribution comes with two utility programs that allow you to convert sed and gawk programs into Perl programs. Because Perl is a superset of both these languages, any programs that can be written in gawk or sed can also be written in Perl. The two programs that perform these conversions are called a2p for converting gawk programs to Perl and s2p for converting sed programs to Perl.

Note:  The reason that the gawk to Perl conversion utility is called a2p instead of g2p is that gawk is the GNU version of another program called awk.

To run the a2p program, simply enter the following command:


a2p gawk_program >perl_program


gawk_program is the gawk program you want to convert to Perl, and perl_program is the name you want to give to your new Perl program.
To run the s2p program, enter the following command:


s2p sed_program >perl_program


sed_program is the name of the sed program you want to convert to Perl, and perl_program is the name you want to give to your new Perl program.
Summary
This chapter introduces what is arguably the most powerful language available on Linux. Perl is a vast language. It contains operators that provide you with almost any function you could want to perform in the Linux environment. The size of the language makes becoming an expert Perl programmer difficult, but at the same time it isn’t that hard to learn to use Perl for simpler tasks.

Although this chapter presents a fairly complete overview of the Perl language, it barely scratches the surface of the features that are available in Perl. If you want to learn more about Perl, refer to the Perl manual pages. You can also read more about other programming languages that are useful with Perl or find associated material in other chapters.

awk, a powerful pattern-action language that complements Perl, is discussed in Chapter 25, “gawk.”
Tcl and Tk, both handy scripting utilities, are discussed in Chapter 29, “Introduction to Tcl and Tk.”
CGI programming, which Perl is particularly well-suited for, is discussed in Chapter 52, “CGI Scripts.”





Previous
Table of Contents
Next














Wyszukiwarka

Podobne podstrony:
521 523
15 (522)
521,37,artykul
Projekt Szczecin 522
517 521
522,21,artykul
519 521
522 528
2011 01 09 WIL Wyklad 17id 521
the mentalist 522 hdtv lol
521 524

więcej podobnych podstron