<PRE>

#! /usr/local/bin/perl
# print out a MIME header so the server knows
#this is an HTML document
print qq|Content-type: text/html;\n\n|;

# print out standard HTML beginning of document
print qq|&lt;html&gt;&lt;head&gt;&lt;title&gt;Mike Ellsworth's Tool Time&lt;/title&gt;\n|;
print qq|&lt;/head&gt;&lt;BODY bgcolor="#ffffff"&gt;\n|;

# assign the environment variable to a Perl variable
# if you want to get fancy, you can add some code to put the parts 
# into an array by splitting on the comma between MIME types
$accepts = $ENV{'HTTP_ACCEPT'};

# now test to see if the string jpeg exists in the environment
if ($accepts =~ /jpeg/i) {
   print qq|&lt;img border=0 src="testme.jpg" alt="Yo" align=left&gt;&lt;/a&gt;|;
} else {
   print qq|&lt;img border=0 src="testme.gif" alt="Yo" align=left&gt;&lt;/a&gt;|;
}
# read in the base document and print to STDOUT
open(READ, "testimg.txt");
     while (&lt;READ&gt;) {
          print;
     }
close(READ);

# close the document
print qq|&lt;/body&gt;&lt;/html&gt;\n|;
</PRE>