in reply to Setting Global Variable in Sub

A CGI is not persistent. So once the execution finishes, the stuff that the script used is gone, and there's no way you can retrieve it

Besides, if you're not careful, it's a really bad idea to use the same global variable persisting across multiple requests. What if different users access the CGI script in succession? And I personally see no reason to keep a cookie out of all things...

If you want to keep state, you would need to do it in some sort of db ( which, if the application is simple enough, can be just a plain text file ), or do some other trickery with hidden fields or something

  • Comment on Re: Setting Global Variable in CGI scripts