general tip for this case: make sure auto-flush is on.. do: $|=1; before you start printing.
You could put the "pls wait" message in a <div> tag and add javascript code via <body onLoad="..."> that uses css dom to hide the message div so that it appears to vanish.
(probably best.. this will be a very simplifed, specific case of merlyn's article) Store the $cc result somewhere (i like Cache::FileCache) and redirect (i think using javascript/onLoad will work) to a cgi (same file w/flag maybe) that will fetch the $cc from the cache and display it.