CGI Hello World
Start with the CGI version of “Hello World”. Although simple, the program may be more of a challenge to get running than your usual Perl program.
The program itself is simple enough, as shown in Listing 12.1.
Listing 12.1. hello.pl
#!/home/sdo/local/bin/perl –T # Replace the above line with the path # to your Perl program use strict; use warnings; print <<EOF Content: text/html <HEAD><TITLE>Hello</TITLE></HEAD> <BODY> <P> Hello World! </BODY> EOF |
The first thing to notice is that the program begins with the line
#!/home/sdo/local/bin/perl –T
This is a special “magic line” used on UNIX/Linux systems to turn the script into a program. (See Appendix B, “Turning Perl Scripts into Commands,” for details.) You’ll have to replace ...
Get Perl for C Programmers 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.