[Pdx-pm] hash of hashes in TT2

Thomas J Keller kellert at ohsu.edu
Fri Jan 5 11:42:27 PST 2007


Greetings,
I've pulled out enough hairs on this. I can't find an example in the  
TT book. So I request the help of you, oh mongers most excellent:

I have a TT data structure defined as a hash of hashes and I can't  
figure out how to iterate through them. Here's the code:
# /templates/lib/fees:
[% #define fees
     fees = {
         dseq = {
             A   = {
                 title = "cadillac"
                 fee = 25
             }
             B   = {
                 title = "economy"
                 fee = 15
             }
             C   = {
                 title = "scooter"
                 fee = 9
             }
             D   = {
                 title = "Do-it-yourself"
                 fee = '2.60'
             }
             E   = {
                 title = "Fragment Analysis, aka AFLP"
                 fee = '2.60'
             }
          }
     };
%]

# from templates/src/dseq/index.html
..
         <ul>
             [% FOREACH key IN fees.dseq.keys %]
                <li> [% key %] mode, [% fees.dseq.key.title %]: [%  
fees.dseq.key.fee %] </li>
             [% END %]
             <li>Discounts available for high-throughput work.  
Contact the lab for details.</li>
         </ul>...
This gives no error but doesn't return anything for [%  
fees.dseq.key.title %]: [% fees.dseq.key.fee %]

Do I need to change the data structure to a List of hashes? or can I  
get to the internal hash directly?

Thanks,
Tom K
kellert at ohsu.edu
4-2442


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/pdx-pm-list/attachments/20070105/c6f32431/attachment.html 


More information about the Pdx-pm-list mailing list