Usually, though, what you want to do is done with a script like this (pseudocode):
print HTTP_headers
print start_of_HTML_page_up_to_search_form
print search_form
if (script_called_with_search_term_as_parameter) then
___get search_results
___format search_results
___print search_results
endif
print rest_of_HTML_page
having the perl script just write directly to the same page that contains the search form
I don't think this is doable because when the browser issues a HTTP request to the web server the browser considers the reply a new page/file. With the frame method I described above this new page gets written into a frame, without frames the newly served page replaces the previous page in the browser window.
I use this technique to return search results at my site for a query. You enter a search string and then the script reads in the page template - adds the body text - and then spits the page out.
not currently supported by most browsers
try what is called client-pull,
put your dynamic results in an iframe...