in reply to Re: Re: (2) Got those HTML::Template and subroutine blues (tie hash o' hashes?)
in thread Got those HTML::Template and subroutine blues

Personally I avoid using the C-style for, since I find it harder to see exactly what what it is doing at a glance. I also avoid loop indexes as they aren't very perlish. This is another way to do it, but it destroys the arrays, which may or may not be acceptable.
while ( @tmpl_array ) { my ($loop, $aref) = splice @tmpl_array,0,2; my @vars; while (@$aref) { my ($name, $url) = splice @$aref,0,2; push @vars, { name => $name, url => $url }; } $tmpl->param($loop, \@vars; }
  • Comment on Re: Re: Re: (2) Got those HTML::Template and subroutine blues (tie hash o' hashes?)
  • Download Code