programming-examples/perl/CGI/Cookies and Session Tracking.pl

21 lines
427 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/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";