sugoo has asked for the wisdom of the Perl Monks concerning the following question:

$cookie = $cgi -> cookie(-name =>'ipcookie', -value => $remote_ip, -ex +pires => '+10s'); If a cookie is assigned to a variable as in this case, even when the cookie expires wouldn't the $cookie variable store the ip? or CGI cookie is designed to expire the variable as such? Please comment.
  • Comment on no results while checking if cookie exists

Replies are listed 'Best First'.
Re: no results while checking if cookie exists
by Eliya (Vicar) on Mar 01, 2012 at 14:31 UTC
    it is not checking the part of 'if($cookie)' exists

    You're not assigning anything to the $cookie variable, before you test it in the if...

    See To retrieve a cookie, ...

      oopsy, corrected it. thank you for your time.

      In between, my cookie is not expiring within the time frame given.

        the expire value is not working out and value is not expiring on its own. to ensure code is right, i tried loading after clearing browser cache. works as expected.