The default path for CGI.pm cookie is '/'. If your JS is creating the cookie in another path Perl probably will not read it. You can see the cookie's path in your browser (at least I can on Firefox).
Igor S. Lopes - izut surrender to perl. your code, your rules.