in reply to Doubt on perl instances! Plz reply...

When CGI scripts are run by a web server, each request creates a new Perl interpreter at the beginning and destroys it at the end. The modules you use will have to be loaded and compiled every time because each time you have a brand new interpreter.

That's the reason people invented things like mod_perl and FastCGI, which can keep Perl interpreters in memory and reuse them. Using CGI the way you are is normal, and will not fill up memory (since the interpreters keep getting destroyed), but it is much slower than mod_perl and friends.

Regarding your "new CGI" question, you are assigning the instance to a lexically scoped ("my") variable, which means that the instance of CGI will be destroyed when that variable goes out of scope.

  • Comment on Re: Doubt on perl instances! Plz reply...