[Pdx-pm] hash of hashes in TT2
Thomas J Keller
kellert at ohsu.edu
Fri Jan 5 11:54:08 PST 2007
I switched the data to a list of hashes and that simplified it. I'd
still like to know how to iterate through the [% fees.dseq %] hashes
though.
(I just like hashes better than lists for ease of understanding down
the road.)
Thanks,
Tom K
On Jan 5, 2007, at 11:42 AM, Thomas J Keller wrote:
> 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
>
>
> _______________________________________________
> Pdx-pm-list mailing list
> Pdx-pm-list at pm.org
> http://mail.pm.org/mailman/listinfo/pdx-pm-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/pdx-pm-list/attachments/20070105/1cc71056/attachment-0001.html
More information about the Pdx-pm-list
mailing list