Perl does not attempt to be a super
language. In fact, compared to some more robust languages out
there, Perl solves only a few, though crucial, problems.
Fortunately however, because Perl is
specialized, it does the jobs it sets out to do exceptionally
well. And, better yet, the limited set of problems that Perl can
solve happens to fit very well with the demands of CGI.
Perl and CGI are simply a match made in
heaven. Common Gateway Interface (CGI), as its name implies,
provides a "gateway" between a human user with unexpected and
complex needs, and a powerful, command/logic oriented server. As
a gateway, CGI must perform one task very well. It must
translate.
All CGI applications must translate the
needs of clients into server requests, and translate server
replies into meaningful and well-presented "answers". This can be
quite a chore, since computers and humans typically speak very
different languages.
As such, CGI must be adept at
manipulating text (be it the text inputted by the client or the
text received from the server). A CGI application must be able to
take "strings" of data and translate them from one language to
another constantly and quickly.
As it so happens, Perl has a wide
variety of tools designed to manipulate strings of data. It is,
in fact, one of the best languages around for string
manipulation.
What's more, CGI must serve as gateway
not just for one client and one server but for as many types of
clients and as many types of servers as possible. It must be more
than a bilingual translator, it must be multilingual, providing
translation services between dozens of browser types, server
types and operating systems.
Again Perl shines. Fortunately, Perl is
highly portable. Due to the hard work and good intentions of many
net hackers, Perl has been ported to just about every operating
system you would want to run a Web server on.
Finally, Perl's weaknesses are not so
negative in a web environment.
Most CGI tasks, which are ultimately at
the mercy of bandwidth speed, do not demand much gusto from the
application. While other compiled languages may boast ten times
the power and speed or Perl, with complex functions up the yazoo,
using one is like bringing in the hydrogen bomb to kill an ant.
Perl is simply the right tool for the job. Other languages are
typically overkill.