#!perl # home.pl use strict; use CGI; my $q = new CGI; print $q->header(),$q->start_html, $q->start_form(-method=>"post",-action=>"wel.pl"), $q->b("ID : "), $q->textfield(-name=>"id", -value=>$q->cookie('id')), $q->submit(),$q->end_form,$q->end_html; #!perl # wel.pl use strict; use CGI; my $q = new CGI; my $id = $q->param('id'); my $cookie = $q->cookie( -name => 'id', -value => $id, -expires => '+2m', -path => '/'); if ( ! $id ){ print $q->redirect(-uri=>"home.pl", -cookie=>$cookie); } else { print $q->header(-cookie=>$cookie); print $q->start_html, $q->a({-href=>'home.pl'},'home'), $q->p("Hello $id"),$q->end_html; }