# load values into %config, template into $string, then... 1 while $string =~ s/\[%\s*(\S+)\s*%\]/$config{$1}/;