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 %]

But I'm sure there must be a better way.

This works:

http://www.template-toolkit.org/docs/plain/Manual/VMethods.html#Hash_Virtual_Methods

# item
Returns an item from the hash using a key passed as an argument.
   [% hash.item('foo') %]  # same as hash.foo

-- Josh

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

Reply via email to