electroman00,
Everyone has suggested using some form of templating and I agree. I also know that sometimes learning method X when what I want to do is Y can be frustrating. Here is an example using HTML::Template - When should I use a dispatch table?. It isn't particularly good but it shows how easy it is and was one I remembered off the top of my head. Don't get frustrated, take things 1 step at a time.