in reply to Re: Re: Redirects and CGI.pm
in thread Redirects and CGI.pm

Therein lies your problem. A redirect is part of the HTTP header; once you print the header (via the header() method) you can't print another one. Try:

print $query->header(-cookie => $cookie_name, -location => 'http://www.somewhere-else.com/');