Freelancer,
You will receive more useful responses to your postings if you include your code (in this case HTML and Perl), and what things you've tried to solve your problem.
Here's a node that can be quite helpful.
Cabrion's answer should be exactly what you need and don't forget to
use strict.
Oh, and welcome to the Monastery.
bassplayer