my $q = CGI->new; # this will return a session object. # if the CGISESSID is avialable via cookie or param # that is what's used, otherwise it is a new session my $session = new CGI::Session("driver:File", $q, {Directory=>'/tmp'}); # this prints a header with the CGISSESSID cookie: print $session->header() # now if you want to stick it in a form as well, get the SESSID my $sessid = $session->id; # and stick it in the form..... print < HTML