use CGI::Cookie; my $c = new CGI::Cookie(-name=>"$test1", -value=>"$test2", -path=>"/", -expires=>'+2y'); print "Location: $url\n"; print "Set-Cookie: $c\n\n";