in reply to HTML::Template - Two columns?

Not especially pretty or Golf-savy, this should do the job:
use strict; use HTML::Template; my @names = qw(name1 name2 name3); my @gpas = qw(4 2 3); my @struct; for (0..$#names) { push @struct, { NAME => @names[$_], GPA => @gpas[$_], }; } my $template = HTML::Template->new(filename => 'template'); $template->param(STUDENT => \@struct); print $template->output; <!-- template file --> <TMPL_LOOP NAME=STUDENT> Name: <TMPL_VAR NAME=NAME><br> GPA: <TMPL_VAR NAME=GPA><p> </TMPL_LOOP>
UPDATE:
wrong solution, move along - nothing to see here . . .

Jeff

R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
L-L--L-L--L-L--L-L--L-L--L-L--L-L--

Replies are listed 'Best First'.
Re: (jeffa) Re: HTML::Template - Two columns?
by mikeB (Friar) on Jul 04, 2001 at 00:39 UTC
    Jeff,

    Thanks, but no. That's similar to the current code. What I'd really like is:

    name14name22
    name33

    Template's implicit indexing of the array makes this more difficult than it might be.

    I could do

    [ oddName => xxx, oddScore => zzz, evenName => xxx, evenScore => ddd ]
    but that doesn't seem elegant :)

    Mike