Scripting Languages

Just as there are "religious wars'' between the followers of vi and the devotees of emacs (as we discuss in Chapter 11), or the lovers of KDE and the true GNOME believers, so there are devotees of scripting languages — a division exists between Perl and Python users. Ruby is the newcomer in this field and many of the criticisms of Perl made by the Python users are echoed by the Ruby people.

■ Perl is far more common, and arguably more versatile, if only because of the very large number of modules that have been written for it. It is possible to write much more compact code in Perl, which is full of shorthand and special notations.

■ Python is newer, cleaner, and arguably more elegant. It is certainly the easier language to learn. It is much easier to read another person's Python code than another person's Perl code.

The difference between the languages is perhaps best summed up by each slogan. While the Perl slogan says, "There's more than one way to do it,'' the Python responds, "There should be one — and preferably only one — obvious way to do it.''

This is not the place to more than briefly introduce either language. Many resources are available on both of them (see the "Comments and Resources'' section later in the chapter for some resource options).

If you aren't familiar with either and you want to do useful scripting quickly, we advise you to learn Python. However, if you are likely to be working in an environment where you are required to maintain scripts that others have written, then Perl will very probably be the right first choice.

Here we simply offer a tiny example of a very simple task done in the two languages, and some pointers to further information.

Was this article helpful?

0 0

Post a comment