Cookies and Session Tracking : Cookie « CGI « Perl






Cookies and Session Tracking

    
#!/usr/bin/perl

use warnings;
use CGI;
use strict;
print "content-type: text/html\n\n";
my $cgi=new CGI;
my $cookie1=$cgi->cookie(-name=>"myCookie1",-value=>"abcde");
print "Cookie 1: $cookie1\n";


#equivalently:


#!/usr/bin/perl
use warnings;
use CGI::Cookie;
use strict;
print "content-type: text/html\n\n";
my $cookie2=new CGI::Cookie(-name=>"myCookie2",-value=>"fghij");
print "Cookie 2: $cookie2\n";

   
    
    
    
  








Related examples in the same category

1.A Simple Cookie Example
2.A Simple Cookie Example Using the CGI Module
3.Retrieving Cookies
4.Setting Cookie Expiration Without Using the CGI Module
5.Setting Cookie Expiration Using the CGI Module
6.Sending Multiple Cookies Using CGI.pm
7.Retrieving Multiple Cookies
8.Create cookie
9.Session tracking in our CGI scripts
10.Read cookie value
11.Program to read cookies from the client's computer
12.Time Period Abbreviations for the CGI Module's Header and Cookie Functions