I'm using perl and Template::Toolkit to generate some texts. In the perl program, I defined a hash ref such as
my $user = { "user-name" => "John" };
and passed it to Template::Toolkit
in order to generate John
with the template file. In the template file I wrote
[% user-name %]
But unfortunately, user-name
seemed to be recognized as a subtraction expression (user
minus name
) by Template::Toolkit
.
To confirm my suspicions, I looked into the manual of Template::Toolkit
to find the valid tokens to use in the variable name but found nothing.
So my questions are:
Could you give the list of valid tokens for variable names of
Template::Toolkit
?Could I use some "escaping method" in the template file so that the variable name in perl program could remain
user-name
?