| Perl is a programming
language which can be used for a large variety of tasks. A
typical simple use of Perl would be for extracting
information from a text file and printing out a report or
for converting a text file into another form. But Perl
provides a large number of tools for quite complicated
problems, including systems programming.
Programs written in Perl are called Perl scripts,
whereas the term the perl program refers to the
system program named perl for executing Perl scripts.
(What, confused already?)
If you have used shell scripts or awkor
sed or similar (Unix) utilities for various purposes,
you will find that you can normally use Perl for those and
many other purposes, and the code tends to be more
compact. And if you haven't used such utilities but have
started thinking you might have need for them, then
perhaps what you really need to learn is Perl instead of
all kinds of futilities.
Perl is implemented as an interpreted (not compiled)
language. Thus, the execution of a Perl script tends to
use more CPU time than a corresponding C program, for
instance. On the other hand, computers tend to get faster
and faster, and writing something in Perl instead of C
tends to save your time.
Origins
Perl began as the result of one man's frustration and,
by his own account, inordinate laziness. It is a unique
language in ways that cannot be conveyed simply by
describing the technical details of the language. Perl is
a state of mind as much as a language grammar.
he language is that its name has been given quite a few
definitions. Originally, Perl meant the Practical Extraction
Report Language. However, programmers also refer to
is as the Pathologically Eclectic Rubbish Lister. Or
even, Practically Everything Really Likable.
One of the oddities of t
Let's take a few minutes to look at the external forces
which provoked Perl into being-it should give you an
insight into the way Perl was meant to be used.
Back in 1986, Larry Wall found himself working on a task
which involved generating reports from a lot of text files
with cross references. Being a UNIX programmer, and
because the problem involved manipulating the contents of
text files, he started to use awk for the task. But it
soon became clear that awk wasn't up to the job; with no
other obvious candidate for the job, he'd just have to
write some code.
Now here's the interesting bit: Larry could have just
written a utility to manage the particular job at hand and
gotten on with his life. He could see, though, that it
wouldn't be long before he'd have to write another special
utility to handle something else which the standard tools
couldn't quite hack. (It's possible that he realized that
most programmers were always writing special
utilities to handle things which the standard tools
couldn't quite hack.)
So rather than waste any more of his time, he invented
a new language and wrote an interpreter for it. If that
seems like a paradox, it isn't really-it's always a bit
more of an effort to set yourself up with the right tools,
but if you do it right, the effort pays off.
The new language had an emphasis on system management
and text handling. After a few revisions, it could handle
regular expressions, signals, and network sockets, too. It
became known as Perl and quickly became popular with
frustrated, lazy UNIX programmers.
|