The simple script above should work. How do you know it isn't being sent to the browser? What browser and what debugger are you using? More likely than not either the browser is configured to block cookies or you have accidentally simplified away your problem in preparing code for this site.
Is there a particular reason you are using CGI? CGI was removed from CORE specifically because modern frameworks, such as Mojolicious::Lite, actually get you done faster for even simple projects than either hand-rolled or CGI-assisted web page development. A read through CGI::Alternatives is worth your time.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.