i have a variable
var1 = {
'*' = > {
'counter' = > {
'default' = > '0',
'description' = > 'test'
}
}
}
in perl template toolkit. How can i access the content of '*' in the template.
[% var1.*.counter %]
does not work because of the symbol is no valid name.
You can define a variable to be equal to
*
within the template, and use that instead.But I wonder why you have to have an asterisk as a key in the first place? It would be far better to provide a sensible key at the Perl level, perhaps by writing
before you call the Template Toolkit.