You had a "head" conflict between LWP::Simple and CGI. From the documentation:

Note that if you are using both LWP::Simple and the very popular CGI.pm module, you may be importing a head function from each module, producing a warning like:

"Prototype mismatch: sub main::head ($) vs none"
Get around this problem by just not importing LWP::Simple's head function, like so:

use LWP::Simple qw(!head); use CGI qw(:standard); # then only CGI.pm defines a head
Then if you do need LWP::Simple's head function, you can just call it as:
LWP::Simple::head($url)
I ran your script like this:
#!/usr/bin/perl use strict; use warnings; use LWP::Simple qw(!head); use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); head(); print header, start_html("test"); my $url = 'http://www.perlmonks.net'; my $geturl = url_param('geturl'); my $commentid; if ( defined( $_ = $geturl ) ) { &get_url; } else { &get_site; &print_form; } sub get_url { print qq(<form name="geturl" name="geturl" method="get" action="wp +.pl">); print qq(URL: <input type="text" name="geturl">); print qq(<input type="submit" name="submiturl"></form>); } sub print_form { print "test 1"; } sub get_site { my $content = get($geturl); print "test\n"; }

In reply to Re: Odd LWP::Simple problem, unintentional redirect by Khen1950fx
in thread Odd LWP::Simple problem, unintentional redirect by Anonymous Monk

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.