my @cols = split(/[,\s]+/); my %row; $row{quarantined_id} = pop @cols; for my $key ( qw( month day time category sender ) ) { $row{$key} = shift @cols; } $row{recipients} = \@cols; push @{$data{rows}}, \%row; ... [% FOR row=rows %] [% row.month %] [% row.day %] [% row.time %] [% row.category %] [% row.sender %] [% FOR recipient=row.recipients %][% recipient %]
[% END %] [% row.quarantined_id %] [% END %]