first.perl

#!/usr/local/bin/perl   

MAIN:
{
  printf ("Content-type: text/html\n\n");
  printf ("<html>\n");
  printf ("<head><title>First CGI in C</title></head>\n");
  printf ("<body bgcolor=#ffffff\n");
  printf ("<h1>Hello World!</h1>\n");
  printf ("<hr><h2>The code that generated this output was</h2>\n");
  printf ("<pre>\n");
  if (!open(INPUT, "first.perl")) { 
    printf ("<h1> Can not open first.perl </h1>\n");
  }
  else {
    while ($buffer = <INPUT>) {
      $buffer=~ s/&/&amp;/g;
      $buffer=~ s/</&lt;/g;
      $buffer=~ s/>/&gt;/g;
      printf("%s",$buffer);
    }
  }
  close(INPUT);
  printf ("</pre>\n");
  printf ("</body>\n</html>\n");
  
}