If you’re new to scripting, the most common cause of “internal server error” is likely to be either line endings or file permissions.
As a rule, you want to chmod your executables to 755, and your data files to 644. If you are editing your files in MSDOS (aka Windows) mode and uploading in binary mode, you have spurious Ctrl-M characters at the end of each line.
Uploading in ASCII mode would correct the problem, but that can get confusing. Some CGI files are compiled and need to be uploaded in binary, while scripts edited in MSDOS mode need to be uploaded in ascii.
Easiest solution is simply to leave your scripts in UNIX file format, always and forever, by using a programmer’s editor. That way, you always FTP everything in binary.
If you don’t have a programmer’s editor, I recommend GWD Text Editor. It’s a shareware download, so you don’t need to pay until it proves satisfactory to you. It’s easy for beginners to get used to, and has all the bells and whistles you’re likely to need for the next few years. If you’re not used to keyword highlighting, you’ll especially like that.
People who already know VI (named for a female detective portrayed by Kathleen Turner) or Emacs (Eight Megs And Constantly Swapping) have great editors, but GWD is very easy to learn.