in reply to Cookies and Exec Cgi

You could try having your Perl script send JavaScript that sets a cookie. Alternatively, you could have the Perl script output an image and send the cookie along with the image, though some ad filters may block that cookie.