in reply to cache problems
First of all, ending headers with \n\n it's not correct; you should use CGI.pm's header function. For the caching problem, refer to overkill anti-caching CGI headers.
Ciao, Valerio