Spenser has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a project for work and I have been using the  Near the top of my scripts, I put the following lines, among others:

use CGI qw/: standard/; my $q = new CGI;

This allows me to do lines like this:

print $q->redirect(-location=> "otherscript.cgi?ord_id=$ord_id");

However, I have been running into some problems with passing data from one script to the next (i.e., order numbers).  If the script that has the line "new CGI" sends data to another script that also has "new CGI", the data seems to get wiped out by that line in the second script.  I tried modifying the line in the second script to read just:

my $q = CGI;

That solved the passing problem, but it seemed to make the other "print $q->" type lines a little flat or they did odd things.  I know, I'm being vague, but I'm recalling symptoms from frustrating moments.  I tried alternating between "new" and not "new", but that doesn't always work.  I'm just running around in circles putting out fires and starting other ones.

In summary, I don't know what "my $q = new CGI;" does.  Therefore, I don't know when to use it and how to modify it.  Can someone explain to me the concepts behind it so I'll know what to do, please?  Thanks.