sub add_comma { my ($num) = @_; 1 while $num =~ s/^(-?\d+)(\d\d\d)/$1,$2/; $num; } print &add_comma(-1234567890), "\n";
-1,234,567,890