in reply to strange comma

It doesn't do anything. It's included simply to make adding new items to the list or hash more convenient. Without the extra comma, adding something to the list requires going back to the "clean => ...." line and adding a comma, and then adding the new thing on the next line. It's easy to forget to add the comma, so people often use extra commas after the last item so they won't have to worry about it if they think they'll need to add or remove options from the list often.

Replies are listed 'Best First'.
Re^2: strange comma
by fullermd (Vicar) on Jun 30, 2010 at 00:14 UTC

    Without the extra comma, adding something to the list requires going back to the "clean => ...." line and adding a comma, and then adding the new thing on the next line.

    In addition to that, it also means that the diff between revisions in your VCS (which you of course use, whichever one you use) ends up having that extra -/+ pair of lines just to add the comma, which makes it that much slower to scan visually.

      ends up having that extra -/+ pair of lines just to add the comma

      That leads one of my two reasons for using it: It's easier to add a comma at the end of the line you are typing than to have to modify two lines (instead of one) when adding a new item to the list.

      (The second reason is that I think it looks better with the comma.)

Re^2: strange comma
by Anonymous Monk on Jun 29, 2010 at 11:45 UTC
    perl-mode in emacs doesn't do indentation properly if that comma is missing ...