in reply to "Commifying" a number

I only realized that it incorrectly commifies decimal numbers after lying in bed for a few minutes, and I was too tired to get up and enhance it to fix the problem... :-)

Try the following:

    $number =~ s/((?:\A[+-]?|\G)\d+?)(?=(?:\d{3})+(?:\.|\z))/$1,/g;

Proof that RE's can be fun...