title: Using a variable to access hash keys in Template Toolkit
body: <p>I have an array whose contents is</p>
  
  <pre><code>$VAR1 = {
  '1' =&gt; 'May 05, 2011',
  '0' =&gt; 'Jul 22, 2009',
  '2' =&gt; 'Jun 13, 2012'
  };
  </code></pre>
  
  <p>I am trying to display it in the catalyst template, the code is</p>
  
  <pre><code>[% x = 0 %]
  [% FOREACH mortgage IN mortgages %]
  
  &lt;table width=40% border=1 cellspacing="0" cellpadding="10"&gt;
      &lt;tr&gt;
          &lt;td&gt;Date&lt;/td&gt;
          &lt;td&gt;&lt;b&gt;[% dateformat.x %]&lt;/b&gt;&lt;/td&gt;
      &lt;/tr&gt;
   &lt;/table&gt;
  [% x = x+1 %]
  [% END %]
  </code></pre>
  
  <p>The dateformat.x should display  May 05, 2011 or Jul 22, 2009 or Jun 13, 2012 according to the value of x but the error is that it displays nothing. It shows a blank .</p>
  
  <p>The error I think is that the key in the array is a string while the value of x that is used with the dateformat is numeric. If I add 0 or 1 with the dateformat then it displays correctly([% dateformat.0 %]).</p>