in reply to [untitled node, ID 214828]

You need $referring_url to be interpolated in the new string. For that, you need double quotes:
print redirect("$referring_url&alert=3");
With single quotes, it leaves the string exactly how you have it: i.e, it's a string that begins with a dollar sign, not the contents of the variable. This is why your browser was being pointed to /cgi-bin/$referring_url&alert=3.

Your first example produced a syntax error because the compiler didn't know how to interpret &alert=3 as Perl code -- you didn't have it inside any string.

blokhead