Rick Triplett <[EMAIL PROTECTED]> wrote:
: Sorry; I forgot to include all the code:
:
: I am trying to turn a repetitive assignment into a loop for
: HTML::Template (a Perl loop, not an HTML::Template Loop).
: I'm given a series of scalars (three shown below) and I
: have commented out the $tmpl->param calls (also below,
: which worked fine). I intended the foreach loop to replace
: the long list of calls, but it didn't work, nor did several
: variations I tried. Most of the variations died with the
: error that a scalar was found when an operator was expected.
: The variation below plugged into the template the literal
: '$student_id' instead of its value 'trip304.' I've run out
: of ideas to try and books to look in. Anyone's advice would
: be most welcome!
:
: my @info_prams = qw(
: student_id
: name_full enroll_type
: name_nick account_number
: name_last password
: date_birth student_email
: sex mentor_email
: date_entered suspended
: date_withdrawn
: );
:
: $student_id = "trip304";
: $name_full = "John Smith";
: $name_nick = "Johnny";
It looks like you need a hash.
my $template = HTML::Template->new(
filename => $template_file,
die_on_bad_params => 0,
);
my %student = (
student_id => 'trip304',
name_full => 'John Smith',
name_nick => 'Johnny',
name_last => undef,
date_birth => undef,
sex => undef,
date_entered => undef,
date_withdrawn => undef,
enroll_type => undef,
account_number => undef,
password => undef,
student_email => undef,
mentor_email => undef,
suspended => undef,
);
$template->param( \%student );
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>