use strict; use warnings; use CGI; use CGI::Cookie; my $cgi = CGI->new; my $w = $cgi->param('w') || 'start'; my $number = $cgi->param('num') || 23; if ($w eq 'start') { print $cgi->header; print "
print $ENV{HTTP_COOKIE}
"; print qq{cookie}; } elsif ($w eq 'cookie') { my $cookie = CGI::Cookie->new(-name => 'ID', -value => $number); print $cgi->redirect( -uri => '/test/cookie_redir.pl?w=start', -cookie => $cookie, ); }