Thanks a lot. The comments were an eye opener. I tried tracking the back and forth HTTP requests and responses. The domain was changing because of which the cookie value set in perl(in another domain) disappear. Making all domains the same resolved the issue