in reply to passing arguments between scripts

You're really off base here. Using CGI in the second script is goofy. Plus, you're calling it by means of system()? You do realize that system won't give you anything back, right?

First, make sure that your trim(uc(thing)) actualy makes your string safe to use (I kind of doubt it; better to do an explicit string check or match it to a hardcoded hash key).

Then, clarify what it is you want to do in the second script. Do you want to do actual CGI stuff? Why don't you hand off to it with an exec, then, instead of a system? Having two scripts contending for the I/O of CGI is a path to failure.