Re: [htmltmpl] HTML::Template Loop Issue
Brought to you by:
samtregar
From: Roger B. W. <ro...@fi...> - 2010-04-08 22:13:30
|
On Thu, Apr 08, 2010 at 05:20:36PM -0400, Shawn Scott wrote: >When I run this code it gives me the correct number of elements, based on >the number of errors in the loop @error array. The only issue each one is >shown as the last line pushed to the @error_loop. Well, yes. You're defining a single hash and pushing multiple references to it. Chech out perldoc perlref... For this specific problem, cut out the middleman: my @error = @_; my @error_loop = (); print header; foreach (@error) { push(@error_loop, {ERROR_DATA => $_}); } my $template = HTML::Template->new(filename => "$html_root/signup_error.html"); $template->param(ERROR_LOOP => \@error_loop); print $template->output; Roger |