The low-fi way would be some cleverly crafted search-and-replace:
sub fill_template { my ($string,$values) = @_; $string =~ s!\$\{(.*?)\}!$values->{$1}!eg; $string };
But in most cases, you will want to simply use one of the various already existing templating systems, depending on if you only want to template HTML-like files or also other stuff:
In reply to Re: Template strings
by Corion
in thread Template strings
by mclow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |