Isn't the last curly brace in front of the square brace the real problem? Can't you just remove that one?If you need more help, then post your original code... or rewrite the segment as perl in between <iw_perl> tags instead of lobotomizing yourself with iw_pt tags.
my @vals = retrieve_all_values_from_field;my $val = join(',', @vals);
#... set $val, appending comma to each value ...$val =~ s|,$||;