On Thursday 26 October 2006 11:55 am, Mike Friedman wrote:
> Perhaps this is a stupid question, but I can't seem to find the answer in
> TFM.
>
> How do you look up a hash value whose key has a space in it?
>
> I tried:
>
> [% foo."bar baz" %] and [% foo.${bar baz} %]
>
> but each of these results in a syntax error.
>
> I can use a workaround:
>
> [% SET key = "bar baz" %]
> [% foo.$key %]

perl -e 'use Template; Template->new->process(\qq{([% n="a b"; \$n %])([% 
\${"a b"} %])\n},{"a b"=>"z"})'
(z)(z)

So - for your case [% foo.${"bar baz"} %] would work as well.

Paul

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

Reply via email to