You need to use double quotes so Perl will interpolate the variables inside the string.
print redirect("$referring_url&alert=3");
Single quotes mean a literal string which is exactly what you got in the second case. In the first case, Perl interprets it as perl code. This is the error I get when running the snippet:
Operator or semicolon missing before &variable at -e line 1. Ambiguous use of & resolved as operator & at -e line 1. Can't modify bitwise and (&) in scalar assignment at -e line 1, near " +value)"
With Perl, it you get a "500 Server Error", it means that the script died. You should look in the web server error log, or run the script from the command line, to figure out why it died.

In reply to Re: redirect with CGI.pm by iburrell
in thread [untitled node, ID 214828] by Samn

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.