And to include the cookie functionality that costas later mentioned he wanted, you could do:
use CGI;
my $page = new CGI;
my $url = 'www.somewhere.com';
my $cookie = $page->cookie(-name=>'sessionID',
-value=>'xyzzy',
-expires=>'+1h',
-path=>'/cgi-bin/database',
-domain=>'.foo.bar',
-secure=>1);
print $page->redirect(-location=>'http://somewhere.else/',
-cookie=>$cookie);