#!/usr/bin/perlrequire "cgi-lib.pl";#require "CGI.pm";print &PrintHeader;# When writing files, several options can be set... here we just set one# Limit upload size to avoid using too much memory$cgi_lib'maxdata = 500000; # Start off by reading and parsing the data.  Save the return value.# We could also save the file's name and content type, but we don't# do that in this example.$ret = &ReadParse;# A bit of error checking never hurt anyone&CgiDie("Error in reading and parsing of CGI input") if !defined $ret;&CgiDie("No data uploaded",        "Please enter it in <a href='fup.html'>fup.html</a>.") if !$ret;@lines = split(/\r\n|\r|\n/,$in{'upfile'});for ($i = 0; $i <= $#lines; $i++){ @line = split("\t",$lines[$i]); $email = shift @line; next if ($email =~ m/^\s\s*$/); open (MAIL, "| /usr/sbin/sendmail -t"); #print "Email: $email\n"; print MAIL "From: $in{'instructoremail'}\n"; print MAIL "To: $email\n"; print MAIL "Re: Writing Feedback\n";print MAIL <<HEADER;....................FEEDBACKInstructor: $in{'instructor'} <$in{'instructoremail'}>Class: $in{'class'}....................HEADER for ($j = 0; $j+1 <= $#line; $j += 2) {print MAIL <<ESSAY;********** Essay **********ESSAY  print MAIL $line[$j],"\n";print MAIL <<ESSAY;>>>>>>>>>>> Feedback>ESSAY  $comments = $line[$j+1];  #pos($comments) = 0;  $total=0;  print MAIL "> ";  while ($comments =~ /(\S+)(\s*)/g)  {   $nonspace = $1;   $space = $2;   if ($total + length($1) > 100)   {     print MAIL "\n";     print MAIL "> ";     $total = 0;   }   print MAIL $1,$2;   $total += length($1)+length($2);  }  #print $line[$j+1],"\n";print MAIL <<ENDESSAY;>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ENDESSAY }}print "Email messages sent.\n";