At Fri, 26 Apr 2002 09:40:14 +0100,
Andy Wardley wrote:
 
> This is an approach I've used to great effect in the Template Toolkit.
> In this case, the iterator controlling a 'FOREACH' loop is aliased to 
> the 'loop' variable
> 
>    [% FOREACH x = y %]
>       [% "<table>\n" IF loop.first %]
>       <tr>
>         <td>[% loop.count %]</td>
>         <td>[% x.key %]</td>
>         <td>[% x.val %]</td>
>       </tr>
>       [% "</table>\n" IF loop.last %]
>    [% END %]
> 
> Builtin support for iterators can make difficult things easy.  Ruby's 
> implementation is worth a look for inspiration (as indeed is most of the 
> Ruby language :-)

Have you looked through Inline::TT, a mad hack by me? I suppose you'll
find it interesting! ;)

  http://perlmonks.org/index.pl?node_id=162123

--
Tatsuhiko Miyagawa <[EMAIL PROTECTED]>

Reply via email to