in reply to Perl CGI redirect

If you are doing a redirect, the redirect should be the ONLY THING sent to the client.

In your case, you are printing the header before redirect.

From the docs (emphasis mine):

The redirect() method redirects the browser to a different URL. If you use redirection like this, you should not print out a header as well.

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs

Replies are listed 'Best First'.
Re^2: Perl CGI redirect
by Anonymous Monk on Apr 16, 2013 at 14:22 UTC

    Thanks for the reply. Where I can specify that ?

      The order of operations in the script ought to be something like this:

      1. Create the CGI object
      2. Check the params
      3. If the params are good for the redirect, do that and exit
      4. Otherwise, print your header and the form and maybe some error message if the params were invalid

      While you are there, you might also want to think about why you are using CGI twice, why you are using Getopt::Long and Fcntl and then apparently not referring to them, why you are not using strict and warnings, just how dangerous it is to shell out to a script located in /tmp and why you aren't running in taint mode.