my $cgi = new CGI (); my $cookie = $cgi -> cookie ( "WHATEVER" ); if ( defined $cookie ) { #cookie is there and do with it what you want, we'll print it: $cgi -> cookie ( "WHATEVER" ); } else { # Make a cookie my $cookie = $cgi -> cookie ( -name => "WHATEVER", -value => "WHATEVER" ); print $cgi -> header ( -type => "text/html", -cookie => $cookie ); }