On Wed, 12 May 2004, Carl Franks wrote: > my $cols = 3; > > my @foo = ({one => 1, ein => 1}, {two => 2, zwei => 2}, > {three => 3, drei => 3}, {four => 4, vier => 4}); > my @bar;
>From here, wouldn't it be simpler to use splice? push @bar, [splice @foo,0,$cols] while @foo; It has the disadvantage of being destructive of @foo, but it's ever so much easier on the eyes (well, my eyes, anyway). And then once you have the 2D array of rows, you'll need (unless this feature's crept in while I wasn't looking) to transform it to an array of hashrefs with the sub-loop under the appropriate key: $tmpl->param( loop => [ map +{subloop => $_}, @bar ]); This puts me in mind of a feature I was once planning to either ask for or attempt to produce (and may yet): some analog to $_ for HTML::Template loops. I don't know how common a situation is is, but loops with exactly one parameter (be it a sub-loop or a single TMPL_VAR) seem to occur frequently in my (relatively limited) use of H::T. Being able to use something like <TMPL_VAR _ > and pass an arrayref to param() instead of mapping it to an AoH would produce a small but measurable improvement in my quality of life. Is this something that's been looked at before and decided against, or would it be worth contemplating next time I have coding time on my hands? --Ben -- Eat drink and be merry! Tomorrow you may be in Utah. ------------------------------------------------------- This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO. http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users