in reply to Eliminating last comma
If so, then you know wrong. $ matches the end of the string (just after the last character), not the last character itself. (It's also possible that you just phrased it unclearly, but I figure better safe than sorry...)
Aside from that, avoid adding the comma in the first place if possible (probably by using join to buld the string), use s/,$// if not, just like others have said.
|
|---|