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