in reply to blank value from text box

You get the "500 Bad header" beacuse your script throws an error which gets send to the webserver before the necessary headers have been generated and the server cannot deal with it.

In pre-production code, I like to use use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; so in case of an error, at least my browser shows the error itself in a nice way, rather than the Error 500 only and forces you do dig through the web-server's error logs.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law