#!/usr/bin/perl -wT use strict; use CGI; my $q= CGI->new(); if (!$q->param('pass'){ print_form($q); } else { submit_data($q) } sub print_form{ my $q =shift; print $q->header(). $q->start_html(). $start_form(-method=>'POST', -action=>'/cgi-bin/somepage.pl'). $q->b('Pass:'). $q->textfield(-name=>'pass'). $q->br(). $q->b('Name:'). $q->textfield(-name=>'name'). $q->br(). $q->b('URL:'). $q->textfield(-name=>'url'). $q->submit(). $q->end_form(). $q->end_html(); } sub submit_data{ my $q=shift; # No need to go through all that form decoding stuff here. # It's done automatically, and in the Right Way by CGI.pm. #do stuff with data. }