in reply to Regular question

Perhaps the best way would be to reverse the number and then add in commas every three, and reverse back, such as:

#!/usr/bin/perl -w use strict; sub commafy { my ($num)=@_; $num=reverse $num; $num=~s/(\d{3})(?=\d)/$1,/g; $num=reverse $num; } my $example = commafy(123456789); print "$example\n";
Picked up that little trick here, and it's rather useful.

=Blue
...you might be eaten by a grue...

UPDATE: The links Fastolfe gave lead to more complete answers then mine, which only deals with integers.