note
btrott
Just try using "sub.domain.com" as the domain. If that's
what your domain always is (ie. you don't have other domains
like "foo.domain.com" that you want to set the same cookie
for), just use that.<p>
And it's "HTTP_COOKIE", not "HTTP-COOKIE". It's an underscore
("_").<p>
And, finally, you really should be using CGI::Cookie. From
the docs:<p>
To set cookies:
<code>
# Create new cookies and send them
$cookie1 = new CGI::Cookie(-name=>'ID',-value=>123456);
print header(-cookie=>[$cookie1]);
</code>
To fetch cookies:
<code>
%cookies = fetch CGI::Cookie;
$id = $cookies{'ID'}->value;
</code>
Read the documentation for more info, particularly on
setting the domain (look at the code [setantae] posted).
6372
6381