http://qs1969.pair.com?node_id=765

Current Perl documentation can be found at perldoc.perl.org.

Here is our local, out-dated (pre-5.6) version:

Instead of sending back a Content-Type as the headers of your reply, send back a Location: header. Officially this should be a URI: header, so the CGI.pm module (available from CPAN) sends back both:

    Location: http://www.domain.com/newpage
    URI: http://www.domain.com/newpage

Note that relative URLs in these headers can cause strange effects because of ``optimizations'' that servers do.

    $url = "http://www.perl.com/CPAN/";;
    print "Location: $url\n\n";
    exit;

To be correct to the spec, each of those "\n" should really each be "\015\012", but unless you're stuck on MacOS, you probably won't notice.