The stupid question is the question not asked | |
PerlMonks |
TemplateTookit: Regular Intervals in a FOREACH constuctby pboin (Deacon) |
on Mar 14, 2006 at 13:22 UTC ( [id://536568]=perlquestion: print w/replies, xml ) | Need Help?? |
pboin has asked for the wisdom of the Perl Monks concerning the following question: Warm greetings from the backwoods of Pennsylvania. I've created a very simplistic example that should illustrate my question. Basicaly what I'm trying to do is have my loops interrupted at regular intervals. If I were to do this in perl only, I'd have a main loop, with a test for "if $count % 2". If that test was true, I'd do the special operations and then continue. However, working in Template Toolkit, I don't seem to have access to the modulus operator (or, I don't understand the syntax for IF). When the following template runs, I get nothing. When I take the 'IF' block out, I get my list, but of course without the separators which I'm trying to get. How would one go about making an insertion at a regular interval? Update: I am embarrased to admit that I fell for the old '=' vs. '==' trick. rafl hit it right away. I'm trying to tell myself I missed it 'cause my eyes weren't looking for Perl syntax, but I'm still *really* ashamed. Code fixed.
Back to
Seekers of Perl Wisdom
|
|