http://www.perlmonks.org?node_id=44478


in reply to Cookies

Sure, but you need to have a carriage return between them:
print <<HEAD; Set-Cookie: Name=foo Set-Cookie: Passwd=bar HEAD
And then end your HTTP headers with two carriage returns, per the usual.

Alternatively you could use CGI::Cookie. From the docs:

use CGI qw/:standard/; use CGI::Cookie; # Create new cookies and send them $cookie1 = new CGI::Cookie(-name=>'ID', -value=>123456); $cookie2 = new CGI::Cookie(-name=>'preferences', -value=>{ font => Helvetica, size => 12 }); print header(-cookie=>[$cookie1,$cookie2]);