Please don't write Yet Another HTML Templating Scheme. I'd suggest Template Toolkit. Go hence, right away. Do not
reinvent the wheel until you understand ALL THE OTHER WHEELS first. And asking basic questions like "how do I use eval?" already scares me about you.