>  what I'd like to do is this:
>  
>  [% hash.domain__${d} %]
>  
>  but template toolkit balks at that.  If I set a seperate
>  variable to "domain__${d}" and use that as the key, it
>  works fine.  But I'd like to do this in a single statement
>  as it'll be repeated many times in my template.  Is there
>  a way to do it?

You've found the proper solution... I don't think anyone has
posted a way around doing it as a two step process. Of course,
it seems to me you should just do the string-ify once and then
use that new variable and you're keeping the multiple uses
EASIER to read but that is just me.

Any reason why you couldn't refactor that a bit to be
  [% hash.domain.$d %]
since presumably there are other prefixes you're working
around?

Remember, whenever you catch yourself doing "a1, a2, a3, a4"
you should refactor to an array and when you make variables
"aaathis, aaathat, aaatheother" you should likely refactor
to a hash.

The reason why interpolated variables are painful in perl
- and just about every other language - is that there is
a better, clearer way about 99.99% of the time. 

:)

--mark mills
Xodiax Engineering

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to