<?xml version="1.0" encoding="windows-1252"?>
<node id="219285" title="Re: Template Question" created="2002-12-12 06:30:59" updated="2005-06-03 11:51:41">
<type id="11">
note</type>
<author id="5094">
stefan k</author>
<data>
<field name="doctext">
Hi,&lt;br&gt;
I use to keep my variables on a hash and then use a very similar approach as [abell] (assuming that the variables are written in a Makefile-like style: &lt;code&gt;$(variablename)&lt;/code&gt;:
&lt;code&gt;
foreach (keys %global_variables) {
      $content =~ s/\$\($_\)/$global_variables{$_}/g;
}
&lt;/code&gt;
but with this code it is not possible to escape the variable name expansion (e.g. by putting a &lt;code&gt;\&lt;/code&gt;) in front of the &lt;code&gt;$&lt;/code&gt;. Since there are probably some pitfalls around it would be wise to use an exisiting templating system (btw: is there any reason that so many templating systems exist? ;-)


&lt;p&gt;
&lt;table width="80%" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;small&gt;Regards...&lt;/small&gt;&lt;/td&gt;
&lt;td align="right"&gt;&lt;small&gt;
&lt;a href="http://www.skamphausen.de"&gt;Stefan&lt;/a&gt;
&lt;/small&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;
&lt;small&gt;you begin bashing the string with a +42 regexp of confusion&lt;/small&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</field>
<field name="root_node">
219261</field>
<field name="parent_node">
219261</field>
</data>
</node>
