Perhaps I am missing something in this quest, but it would
seem far easier, if you are using CGI.pm (which you probably
should be if you are working with CGI), to use redirect.
if (condition) {
print redirect(-uri=>'http://www.mysite.com/xyz.html');
} else {
print redirect(-uri=>'http://www.mysite.com/abc.html');
}
See the documentation for CGI.pm for more details.
Important note: the redirect must be the first thing printed
to STDOUT for it to work.
You can use the object oriented version (assuming you have
done $q = new CGI;):
if (condition) {
print $q->redirect(-uri=>'http://www.mysite.com/xyz.html');
} else {
print $q->redirect(-uri=>'http://www.mysite.com/abc.html');
}