in reply to resetting form values

If you are using CGI.pm, it has the feature of "sticky fields", that is, fields that retain their value on output. This is in most cases a very welcome addition as the user dosen't have to type in information again just because the CGI script didn't accept the data as a whole.

To switch off this very convenient behaviour, you can use :

use CGI qw(:standard -nosticky);

or if you want to replace a single form field value with another value from your script, the CGI.pm documentation tells you the following way:

$query->param('field_name','new value');