# Set state to edit if not defined. param(state)||param(name=>'state', value=>'edit'); if (param('state') eq 'edit') { # display the form print start_form('POST',self_url()); # blah blah blah print submit('state','preview'), end_form(); } elsif (param('state' eq 'preview') { # display the results, prettily. print start_form('POST',self_url()), # A bunch of hidden fields to pass our data along hidden(parameter-n, value), # This button commits the data to a file. submit('state','commit'), # This button returns to the edit form, to make changes. submit('state','edit'), end_form(); } elsif ( param('state') eq 'commit') { # Save the file # Print some nice messages. } else { # General purpose error. You should never wind up here # Trap it just in case. } #### # A sample here doc print <<"END_OF_HTML"; Blah laalbalalsdfasdf asdf blaha END_OF_HTML