I've found loop.first and loop.last to be very cool.  Thank you
Andy.

Sometimes you want this:

        "<Thing>";
        FOREACH subthing = thing;
                "<subthing>$subthing</subthing>";
        END;
        "</Thing>";

And sometimes you want this:

        FOREACH subthing = thing;
                "<Thing>" IF loop.first;
                "<subthing>$subthing</subthing>";
                "</Thing>" IF loop.last;
        END;

Why the latter?  If "thing" is empty, then you don't get the <Thing>
brackets at all!  Very cool.

Both are useful in your toolbox.

Maybe we need a "patterns in TT" wiki or something.  Heck, we need
a wiki in TT as well. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Reply via email to