![]() |
|
There's more than one way to do things | |
PerlMonks |
Re: Trouble building hashes from value lists inside a TT2 templateby monsieur_champs (Curate) |
on Dec 19, 2004 at 12:53 UTC ( #415979=note: print w/replies, xml ) | Need Help?? |
Dear fellows As soon as I awake this morning, I devised the solution. Its just a matter of making less de-references against the "item" variable, like this:
If you pay attention, there is two ways of using the $item construct. First, in "scalar context" (kind of), the result is the transformation of a string in a variable name (and the consequent use of its value in place of the string representing the variable's name). Second, in "hash context" (sorry about the poetic license) when you need to use a variable to name a hash key, in a construct like $hash{$key}, and the interpolation uses the variable name as the hash key (using the same construct used to get a variable's value instead of his name in "scalar context". I became confuse with those two applications of the same syntatic construct and the mess was done. :-)
In Section
Seekers of Perl Wisdom
|
|