use strict;
use CGI;
my $q = new CGI;
my $returnurl;
my $pass=$q->cookie('pass');
my $JsessCookie = $q->cookie(-name=>$pass, -value=>'', -path=>'/', -expires=>'-1h');
my $tempcookie = $q->cookie(-name=>'tempc', -value=>'', -path=>'/');
my $url="https://test.com/return=$returnurl";
#tried the below but doesn't redirect shows 302 status
#print $q->redirect(-cookie=>[$JsessCookie,$tempcookie],-uri=>$url);
#this is the working redirection code- but not sure whether its the right way forward
print $q->header(-cookie=>[$JsessCookie,$tempcookie]);
print qq~\n;