I have a problem and i don't why. The problem is with delete cookie. I don't why do not delete all cookies. :(
If you see what is the problem please tell me. Thank you for your time.

#!perl -wT use CGI::Carp('fatalsToBrowser'); use warnings; use CGI qw(:standard); use CGI::Cookie; use CGI; @decodareCookie = ('\%3A','\%20'); %decodareCookie = ('\%3A',':'); $regCode = 01; $nameCookie = "Test"; $query = CGI->new(); print header(-cookie=>$cookie); # Make cookie 1 my $cookieListA = join(":",$nameCookie,$regCode,10); my $listA = join(":",Product1,5); my %cookie = CGI::Cookie->fetch; my $cookie = CGI::Cookie->new(-name=>$cookieList,-value=>$list); # Make cookie 2 my $cookieListB = join(":",$nameCookie,$regCode,11); my $listB = join(":",Product2,1); my %cookie = CGI::Cookie->fetch; my $cookie = CGI::Cookie->new(-name=>$cookieList,-value=>$list); # Make cookie 3 my $cookieListC = join(":",$nameCookie,$regCode,12); my $listC = join(":",Product3,2); my %cookie = CGI::Cookie->fetch; my $cookie = CGI::Cookie->new(-name=>$cookieList,-value=>$list); print "$ENV{'HTTP_COOKIE'}<br><br>"; # Read each cookie and decode foreach (split(/; /,$ENV{'HTTP_COOKIE'})) { ($cookie,$value) = split(/=/); foreach $caracter (@decodareCookie) { $cookie =~ s/$caracter/$decodareCookie{$caracter}/g; $value =~ s/$caracter/$decodareCookie{$caracter}/g; ($idProgram, $nxRegCode, $nxIdProdus) = split (/:/, $cookie); ($nxDenumireP, $canditate) = split (/:/, $value); } if (($idProgram eq $nameCookie) && ($nxRegCode eq $regCode)) { # Delete all cookies my $cookieList = join(":",$idProgram,$nxRegCode,$nxIdProdus); my $list = $canditate; my %cookie = CGI::Cookie->fetch; my $cookie = CGI::Cookie->new(-name=>$cookieList,-value=>$list,-expire +s=>'-1h'); print "Delete cookies : $regCode $nxIdProdus $canditate $nxPretP | "; } }

In reply to Problem to delete a cookie by webstudioro

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.