A Simple Perl Script
-
Don't worry about syntax yet, this is just a demo.
-
The script:
#!/usr/local/bin/perl
print "Content-type:text/html\n\n";
print "<html><head><title>Here's my HTML!</title></head><body>";
print "Here is a simple perl script to demonstrate printing a simple
HTML page.";
print "<h2>You can use <i>any</i> HTML tag you wish!</h2>";
print "</body></html>";
-
The first line is called the shebang line: it tells oz where the
Perl script is located.
-
The second script is necessary for the browser to know what is coming.
It tells the content type, then writes two newlines (\n).
-
Important: Without these lines, your script will not work!
-
Everything else is just plan HTML. Note that print means to
print to the standard output, which is what the browser will get.
-
You can write this in Notepad and FTP it to oz, or you can write it in
pico.
-
Either way, it must reside in .www/cgi-bin
-
Note the URL, though: http://homepages.uc.edu/cgi-bin/cgiwrap/jonesbr/simpleperl.pl
This is because http://homepages.uc.edu/cgi-bin/cgiwrap/ is mapped to the
.www/cgi-bin directory of the user named jonesbr (in this case).
This is also very important!
-
Let's give it a whirl!
Perl Data
Home