We would need to see an excerpt of your script to really understand what is going on here. But it is safe to say that, one way or the other, you’re not actually seeing what you think you’re seeing: a standard CGI script is not persistent.
... or, maybe it is, and maybe that’s some kind of fee-chur of the particular web server that you’re running. AS/400s can run CGI programs persistently. (And they program ’em in, gaaa-a-a-a-aack!, RPG!) :-D
We’ve talked about this sort of thing before: can Perl-CGI run persistently on Windows 2008 with IIS 7.5? how?. There is also this good article on persistence.