Your file is a template. You could use String::Interpolate if you keep your existing template syntax. (Yeah, it's API is weird.) If you're willing to change your template syntax, you could switch to something that's designed to deal with templates like Template::Toolkit.