in reply to Server 500

Perhaps because:

use cgi....

Should be:

use CGI....

Check your webservers error log for further details. Did you try running this from the shell/command prompt? See also "Ovid's CGI Course" Resurrected and Updated!