use strict; use warnings; use CGI qw(:standard); use CGI::Cookie; my @views = qw(first second third fourth fifth sixth seventh eighth); my %cookies = CGI::Cookie->fetch(); my $x = (defined $cookies{'cookie_i'}) ? $cookies{'cookie_i'}->value() : 0 ; my $view = $views[$x++]; my $cookie = CGI::Cookie->new(-name=>'cookie_i',-value=>$x % @views); print header(-cookie=>$cookie), start_html('session'), h1($view), start_form, submit, end_form, end_html ;