$choices = ",1,2,3,4,5,6,"; print "Perl script output -
choices list before regex = $choices\n"; #string cleanup $choices =~ s/^,//; $choices =~ s/,$//; print "
choices list after regex = $choices\n"; @split_list = split(/,+/, $choices); # debugging output to check split for $i (0 .. $#pub_list) { print "
choice $i = $pub_list[$i]\n"; } $data{$user_type}{$user_company$}{$user_lname}{'choice_list'} = [ @split_list ]; $vars = { data => \%data, }; $template->process($template_file, $vars);