in reply to how do I set a cookie and redirect

Here's an example of how to do it using CGI's OO interface.
use CGI (); my $cgi = CGI->new(); my $cookie = $cgi->cookie(-name => 'test', -value => '1'); print $cgi->redirect(-uri => 'http://www.perlmonks.org/', -cookie => $ +cookie);