in reply to Missing referer argument during redirection

Put it in the query string of the url you are redirecting to:  print "Location: $second_script?referer=$ENV{'SCRIPT_URI'}\n\n";