Examining Perl's Pluses for Programming - dummies

Examining Perl’s Pluses for Programming

By Paul Hoffman

As programming languages go, Perl scores kudos for being easy to learn and easy to use. After studying just the basics of the language, you can write a small Perl program designed to do a simple task.

Computer users can argue ad nauseam about which programming language is “best” or “easiest to use.” The fact is, no single language is perfect for every task, and the top three or four languages for most tasks get the job done equally well. For the novice or intermediate programmer, then, the question is not really what is the best program to use, but which is the easiest one to master.

Certainly, other languages are easy to learn and use, but they do not have the features that make Perl a great all-around language, such as flexibility with the kinds of data it can handle or its ability to deal with objects. Good old BASIC has features similar to the “easy” parts of Perl, but it’s not very good for modern programming because of its lack of flexibility. Microsoft Visual Basic is not nearly as easy to learn as BASIC; although it’s very powerful, many novices find Visual Basic pretty confusing. Some people think C is easy to learn, but difficult to use unless you are very careful because you can create C programs that look great on the surface but do harmful things to your computer. C also loses points in the text-handling area, one of the places in which Perl shines.

That brings us to Java, which many folks either love or hate. It has some great features, such as safe execution of programs in secure environments and easy reuse of programs written by other people. Unfortunately, it fails at the feature for which it was touted; namely, that you can write a program for one type of computer and have the program look and act the same on all other types of computers.

Perl surpasses other programming languages on some common tasks. With Perl, it’s quite easy to open a file on your computer, read it, and make some changes based on what you find in the file. Perl can handle text files with aplomb and has no problems with binary files. Perl is also good at handling text in ways that humans do, such as looking at a sentence and breaking it into words, or sorting lines in alphabetical order.

The ten-second summary of Perl’s strongest points is this: It works great for reading through text files, summarizing processed files or converting files to a different format, and managing UNIX systems. Other languages strive to be elegant or very small; Perl strives to be complete and easy to use.

Another great reason for using Perl is that it’s free. This no-cost policy has prompted many people to help out with the Perl development effort and has resulted in widespread usage of Perl over a relatively short period of time.