In addition to Ovid's great (!) comments, see if you can use
an HTML template system (there recently was a question on this, search).
It helps to seperate the html from the code. I myself have used
HTML::Template, and found it very easy to use.
Put the header and footer files together into one file,
and see how to use <TMPL_VAR> and <TMPL_LOOP>
(from HTML::Template perldoc page), depending on your needs.
Also, I see in your header:
<form action='index.pl' method='get'>
Someday, try replacing index.pl with $ENV{SCRIPT_NAME},
or, if using HTML::Template, <TMPL_VAR NAME="this_script">
Then in your script replace this_script with $ENV{SCRIPT_NAME}:
$template->param(this_script => $ENV{SCRIPT_NAME});
Your script name is bound to change sometime.
-- ar0n