First, how come all the tutorials out there assume your doing your CGI programming in PERL?

Okay, I've copied some code from www.jmarshall.com with regard to how to process input from a form. I'm trying to take information from a text field on a form and use it in a CGI program to search for a TLD.

The 'script' compiles fine. When I run it, though, I get the "Prematrue end of Script Headers" error in my error_log file. The browser just gets a generic 500 error.

I know the bw-whois is working, cuz when I run the script with a constant as the domain name to check, I get a response page without any problems. So I know the error has to have something to do with trying to get the information from the text field and use it in my program.

Doesn't help that I'm really new to both C and Linux, so I've probably taken on too big of a task for my level - but generally that's how I learn.

See attached file for code.