sub SetCookie { my ($name, $default, $domain) = @_; my $cookie = cookie( -NAME => "$name", -VALUE => "$value", -EXPIRES => "+2y", -DOMAIN => "$domain", ); my @ckyContent = split(/\n/, header(-COOKIE => $cookie)); print "$ckyContent[0]\n"; print "$ckyContent[1]\n"; return $value; } sub GetCookie { my ($name, $default, $domain) = @_; my $value = cookie($name) || SetCookie($name, $default, $domain); return $value; }