in reply to how to set a cookie without using CGI.pm?

You should try seeing what CGI does:
perl -MCGI -e 'my $q = CGI->new(); print $q->header(-type=>"text/html +", cookie => $q->cookie(-name=>"foo",-value=>"bar"))'
This prints the "Set-Cookie" line first, and follows the "Content-Type" with the required double-newline

davis
It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.