Introducing UNIX and Linux |
PerlOverview |
Why yet another utility?A theme we have been following through this book is "keep it simple" - that is, if there is a simple utility to do what you need, then use it. However, there will always be situations where you need something more heavyweight than what we have already introduced. We have discussed Awk, and seen that it can process data streams and files in a relatively complex fashion. However, Awk was never designed for sophisticated calculations, and as soon as an application deviates from straightforward processing of character streams, Awk is messy to use. Since Awk was devised in the early days of UNIX, our understanding of how to write a programming language has moved a long way, and the result is Perl. This is not to say that Awk is a bad language - it's not, it's just dated. However, an understanding of Awk is helpful when learning Perl, and as you will see there are tasks for which Awk is still a very appropriate solution. Perl stands for Practical Extraction and Report Language. Don't let that put you off! To the serious UNIX programmer it's the best thing since sliced bread. So what actually is Perl? It's a programming language, with a syntax similar to "C", and it comes complete with a full set of libraries - predefined functions - that access the UNIX kernel. It also has libraries for performing almost any other function you care to name, including database access, cryptography, graphics and internet access. The syntax of Perl is well-designed, but is very terse - it is a language for the skilled programmer, and a beginner would be well-advised to learn another language first before attempting a Perl exercise. Perl is also free, and is open source, which means that it is evolving, and new libraries for it are being continually written. It also means that there is no concept of a "standard" for Perl. The latest version of Perl is version 5, and it is normally contained in all UNIX and Linux distributions. In addition, Perl can be used on other operating systems including MacOS and Windows. |
Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck