I wrote a script that generate a list of words separate by a comma, and the number of words is different each time. Sometimes it there's 1 word, and sometimes there's more.

When there's only one word, it'll display "word,"
and when there's more than one words, it'll display "word1,word2,word3,".

My question is how can i trim the trailing comma so that if there's no more words left, the comma wont show up?

Thank you

Sang N.