Perl cgi script for validating and updating database