Online Learning Applications for Technical English


Home
Syllabus
Assignments

Instructor



Producing Homepages

Instead of writing many "print" statements to write a block of text, you can use a "print up to" function as follows:

Filename: hello_without_so_many_print_lines.cgi
#!/usr/bin/perl

#------------------------------
# [10/30/2002] - File created with one big block
#   of text to print.
#------------------------------

#------------------------------------------------
# Step 1:  Print MIME type header for homepages.
#------------------------------------------------
  print "Content-type:  text/html\n\n";

#------------------------------------------------
# Step 2:  Print HTML contents.
#------------------------------------------------

# Print everything up to the next occurrence of 
# the marker (END).
  print <<END;
<HTML>
<HEAD>
</HEAD>
<BODY>
  Hello, world! (printed with one "print" statement)
</BODY>
</HTML>
END

  exit;
[ View result ]

[ Back ]