in reply to location headers and IE

Did you try using a capital "L" in Location?
print "Location: $url\n\n";
Alternatively, you might investigate using CGI.pm's redirect method:
use CGI; my $query = new CGI; print $query->redirect($url);
According to the docs, the redirect method uses both the Location: and the URI: headers--perhaps this will help?

Also, browsers don't generally like relative URLs in the Location: headers... try switching to absolute URLs if you're using relative.