Others have already given you the answer for this particular problem, so I thought I'd offer some more generic tips.
The text I am using to learn CGI isn't particularly good. ( i.e. many demos, few explanations ).
It was quite some time since I looked at it, but I think that this tutorial by Ovid looked excellent if you want to learn CGI with perl - and moreover, in a clean and secure way too.

Also, if you want to see a little more what happens behind the scenes of a normal header and a redirect, just try this silly little program on the command line (not on the web server):

#!/usr/bin/perl -w use strict; use CGI; my $q = CGI->new; print "This is the redirect header:\n"; print $q->redirect('/login.html'); print "And this is the normal header:\n"; print $q->header; print "And this is an alternative header:\n"; print $q->header('text/plain');
Those are the texts that your script sends to the web browser to tell it what is happening, and what it should do. Either one of these should come first in your script (unless you are doing some by hand manipulation of the headers) and they are not possible to combine. Since you use CGI.pm anyways, might as well use the header function too, instead of printing "Content-type..." by yourself. That way you will not have any spelling errors, and CGI.pm will see to it that it works even on half-broken servers. :)


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

In reply to Re: Perl/CGI redirect. by Dog and Pony
in thread Perl/CGI redirect. by DigitalKitty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.