The relationship between Perl and CGI is often confused, mostly because they are frequently seen together. This occurs so often, in fact, that the term “Perl CGI” became commonplace. In reality, any number of programming languages can be used with the Common Gateway Interface. Additionally, Perl is run through cgi-bin, suggesting a relationship. If that wasnt enough, the file extension is usually .cgi also.
CGI is a standard that provides an interface between a webserver, such as Apache, and clients through a (CGI) script, which can be written in any programming language. However, scripting languages are often used. CGI Scripts take the request from client and will call appropriate functions to return the result to the requested clients. There are many language that could function as CGI language like Perl, C, C++, Tcl, Unix Shell Script, etc. However, Perl is without a doubt the most used languages for CGI scripting.
Perl is itself a high-level, interpreted, dynamic programming language. It was originally developed way back in 1987 to make generating reports easier. It caught on with programmers and has grown and expanded ever since, leading up to the latest release of Perl 6. Perl borrows features from other programming languages including C, shell scripting (sh), AWK, and sed. The language provides powerful text processing facilities without the arbitrary data length limits of many contemporary Unix tools, facilitating easy manipulation of text files. It is also used for system administration, network programming, and applications that require database access. Perl is nicknamed “the Swiss Army chainsaw of programming languages” due to its flexibility and adaptability.
While the PHP language has certainly eclipsed Perl as the server-side language of choice (between the two of them, not Java or ASP), PHP was itself written as a set of Common Gateway Interface (CGI) binaries in the C programming language in 1994, to replace a small set of Perl scripts he had been using to maintain his personal homepage. Today, you will find CGI Script and PHP functionality built into almost every web hosting control panel.