in reply to Help required to improve code

Rule #1: perl -wT,use strict, use CGI; This will never hurt you and cna only serve to safeguard your CGI. Turn off POST uploads and set POST_MAX.
For a needed speed improvement, check out mod_perl or FastCGI which will boost your performance by caching your CGI.
Tip #3: While you're using DBi, you might as well use the "?" which allow you throw in data along the way in your query. In this manner, you could probably conactenate your entire query mess into one or two lines. If you want a real speed improvement, you can read from the dbengine one at a time, see the DBI docs. While this eats up the same memory in the dbengine, the user will see results more quickly which is probably what you want. That way, you can also store count up the first ten and stop automatically instead of reading in the first ten and then displaying them. Anyway, your SQL statement is lousy since it requests all statements, displays the first select few and doesn't even bother to cache the next few. Most dbengines have support for "get me the first ten matches" or something like that. If it doesn't a trick may be to read in all of the matches (simultaneously displaying them), cache them (minimally in timed-out tmp file but better using FastCGI) and the next next theuser comes around, he has his data waiting for him. Currently, you are wasting alot of user time just reading in data from the dbegine that you read only seconds before! As your site grows, the decrease in dbengine performance will be VERY visible. The brand new CGI::Cache is also a nifty module that i would strongly recommend for integration into your script. If you're interested in further reading into the FastCGI/mod_perl issues, click here. (**for some reason, fastcgi.com seems to be down at the current time 11amEST10-5-00 so check it out perhaps a bit later.) But whatever you do take into consideration and integration, it will take some time. Some of your script needs some big rewrites. And as I and tilly were discussing before, this is "real problem" (i.e. nothing to ignore- security, performance, resource waste). If you'd rather not write it yourself, do a search for "DBI search engine" at a few sites and take the optimized code that we've been discussing. One more thing (I know I'm long-winded)- you should use the -compile option in your use CGI qq/.../; statement. This will precompile most of your HTML prints so you end up with something even more decent.
AgentM Systems or Nasca Enterprises is not responsible for the comments made by AgentM- anywhere.