in reply to cookie problem
The cookie was never sent due to the print "Location: wel.pl?";
EDIT:
I see that you've updated your post to use print $cg->redirect("wel.pl"); instead of the "Location:" header. That change won't fix the problem you're having because the attempt to send the cookie following that redirect statement won't be sent.
Personally, I prefer to keep all the cookie data on the server side via the CGI::Session module.
CGI::Session::Tutorial
|
|---|