Your First CGI Program
After all the fanfare, warnings, checklists, and runaround, you're ready to type in your first CGI program. It is shown in Listing 17.1.
Type and save this program as hello. If, in the checklist, you are required to use a certain extension for CGI programs—as noted in "Extension to be used for CGI programs" item—use that extension. Thus, if you're required to name your CGI programs with a .cgi extension, save this script as hello.cgi. If you're required to use .pl, save this script as hello.pl.
You did fill out the checklist, didn't you?
Listing 17.1 Your First CGI Program
1: #!/usr/bin/perl -w 2: use CGI qw(:standard); 3: use strict; 4: 5: print header; 6: print "<B>Hello, World!7lt;/B>"; |
Line 1: This line is the standard ...
Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.