in reply to Sending data for LOOP in HTML::Template

Working with TMPL_LOOP means working with AoHs. This one shows how to change an AoH to add selected items out of an array.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $aoh = [ {col => "col1", val => "val1"}, {col => "col2", val => "val2"}, {col => "col3", val => "val3"}, {col => "col4", val => "val4"}, {col => "col5", val => "val5"}, ]; my @selected = (3, 4, 1); for my $item (@selected) { ${aoh}->[$item]->{selected} = "selected"; } print Dumper($aoh);
Add_on: if you just want to see the selected ones you can use TMPL_IF inside your TMPL_LOOP.