These lecture notes are here for archival reasons. I no longer teach Perl.
As such some of the latest Perl innovations are not present. The notes refer to Perl 5.001
Nonetheless, I still believe that this is a valuable resource.
The latest stable release of Perl is 5.20 – for example, it doesn't have CGI built-in anymore.
Detail on more modern Perl maybe found at:
CGI, or Common Gateway Interface, is the standard programming interface between Web servers and external programs. It is one of the most exciting and fun areas of programming today. The CGI standard lets Web browsers pass information to programs written in any language. If you want to create a lightning-fast search engine, then your CGI program will most likely be written in C or C++. However, most other applications can use Perl.
The CGI standard does not exist in isolation; it is dependent on the HTML and HTTP standards. HTML is the standard that lets Web browsers understand document content. HTTP is the communications protocol that, among other things, lets Web servers talk with Web browsers.
Note If you are unfamiliar with HTML, you might want to skip to the HTML introduction in Appendix B before continuing. Otherwise, take the HTML references in this chapter at face value.
Almost anyone can throw together some HTML and hang a "home page" out on the Web. But most sites out there are, quite frankly, boring. Why? The fact is that most sites are built as a simple series of HTML documents that never change. The site is completely static. No one is likely to visit a static page more than once or twice. Think about the sites you visit most often. They probably have some interesting content, certainly, but more importantly, they have dynamic content.
So what's a Webmaster to do? No Webmaster has the time to update his or her Web site by hand every day. Fortunately, the people who developed the Web protocol thought of this problem and gave us CGI. CGI gives you a way to make Web sites dynamic and interactive.
Each word in the acronym Common Gateway Interface helps you to understand the interface:
CGI applications can perform nearly any task that your imagination can think up. For example, you can create Web pages on-the-fly, access databases, hold telnet sessions, generate graphics, and compile statistics.
The basic concept behind CGI is pretty simple; however, actually creating CGI applications is not. That requires real programming skills. You need to be able to debug programs and make logical connections between one idea and another. You also need to have the ability to visualize the application that you'd like to create. This chapter and the next, "Form Processing," will get you started with CGI programming. If you plan to create large applications, you might want to look at Que's Special Edition Using CGI.