<broken_record>Use CGI.pm (which uses CGI::Cookie internally) to create,set,and get cookies. It will save you A LOT of time, and will create code that will remain compatible into the future.</broken_record>

Originally posted by Hero Zzyzzx it will do a much better job creating RFC compliant cookies than you will.

and is maintained and bugfixed by thousands of volunteers. What happens with your hand-rolled cookie-creation code if cookie standards change down the road? If you're using CGI.pm, your code will automatically get updated. With yours, you'll have to figure it out again and potentially fix it in a lot of places.