I recommend using a templating system like HTML::Template or Template, which is part of the Template Toolkit. They are will do what you are asking and give you flexibility for later. HTML::Template is lighter, and might be a good place to start. By the way, the language is Perl (as you have it in your title) and not PERL (as you have it in your post). There is a difference. :-)