#!/usr/bin/perl -- use CGI(); my $data = 'http://bar/?%2fb=c;d=e'; my $uri = 'http://foo/asp.asp?'.CGI::escape($data); print CGI->redirect( -nph => 1, -uri => $uri, ); __END__ $ perl test.pl |cat -v HTTP/1.0 302 Found^M Server: cmdline^M Status: 302 Found^M Date: Sun, 01 Mar 2009 06:57:57 GMT^M Location: http://foo/asp.asp?http%3A%2F%2Fbar%2F%3F%252fb%3Dc%3Bd%3De^M ^M # perl test.pl | cat -v