Sorry but I'm still not quite clear on what you are trying to do. But I'm going to wager two guesses: 1. Do you want to fetch the page from the URL and display it to the user? In that case, you could drop the start_html() and end_html() calls and simply say print $data; - However, note your script currently does no error handling, and this would only reliably work for plain HTML pages; if you have images, CSS files, etc. those may or may not work correctly depending on how they are referenced in the HTML.

Or, 2. Do you want to redirect the user to the new URL? In that case, look at the redirect function from CGI (section "Generating a redirection header"), and note that you should not output anything else (i.e. no header(), no start_html(), etc.)

Note that you really, really should be doing use warnings; use strict; at the top of your script. See Use strict and warnings.

If I am still misunderstanding what you want to do then what might help would be if you could give a step-by-step explanation of the expected behavior of the user and your script.


In reply to Re^3: Unable to execute URL from perl/cgi script by Anonymous Monk
in thread Unable to execute URL from perl/cgi script by coolsaurabh

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.