use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); # New CGI object my $q = CGI->new(); my $test = $q->cookie("test"); if (defined $test) { print $q->header; print $q->start_html('Test stuff'); print "

\n"; print "I got cookie value: $test
\n"; print $q->end_html; } else { my $cookie = $q->cookie(-name => 'test', -value => 'test value'); print $q->header(-cookie => $cookie); print $q->start_html("Test page"); print $q->p(q[check cookie]); print $q->end_html; }