#somewhere in the beginning of your program # nothing has been sent to STDOUT yet print $cgi->header( -cookie => $your_cookie, -type => 'text/html' );