Here is basically what the print statements would need to look like if you're going to do it yourself;
expires=Wed, 11-Dec-2002 00:00:00 GMT;
Use whatever means you want, but the end result will have to produce the above block, obviously substituting the cookie_name, cookie_value and other variables with your data. The RFC mentioned in the first reply is a good idea to read and I wholeheartedly agree -- if possible, use CGI.pm to accomplish this. It does all the work for you and it's harder to screw it up if you're using the module.