Happy Holidays fellow monks!!
Well, I gave in and installed Template Toolkit, and I am very happy to say that I am loving it - it is a good as everyone said it was.
Here is my question. In constructing the 'vars' array that holds all the varibles that will be processed, I want to do this:
%vars = { name => value, n => v, ...};
$template->process($file,\%vars);
thus, passing a hash reference to the process() function, which is exactly what it calls for. Yet, whenever I do this, it doesn't work, but the next code DOES:
$vars = { name => value, n => v, ...};
$template->process($file, $vars);
Now, how come the latter works, when the former doesn't?? Aren't they both exactly the same thing? The reason I want to use the former is because I want to be able to update the varibles in the vars array on the fly, ie
$vars{'name'} = new_value.
Thanks so much to everyone, you guys are a very great help!! And I am sure there is more questions to come, so brace for impact :-).
R.Joseph
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.