in reply to Detecting Dangling Commas in JavaScript

Nice! Thus, to map this replacement to a vim command (using a vim with perl support):
:command FixCommas perl $s=join(qq{\n},$curbuf->Get(0 .. $curbuf->Coun +t()));$s =~ s#^((?:[^/\n]|/(?!/))*),((?:\s*|//.*$|/\*(?:[^*]|\*(?!/)) +*\*/)*\s*[}\]])#$1$2#mg; $curbuf->Set(0,0,split(qq{\n},$s));
(Tried it as a simple :%!perl -pi -e at first, but vim hated the # characters.)