If you have use CGI.pm to generate the form and then check it with the same script, you can set the form's submit action to self_url. If there are problems with the user input, you can then just print the form again and the previous input will be in there automatically.