http://qs321.pair.com?node_id=457747


in reply to How do I print a large integer with thousands separators?

Here's a simple (and quite fast) one using substr:

my $number = 132452345; for ( my $i = -3; $i > -1 * length($number); $i -= 4 ) { substr( $number, $i, 0 ) = ','; }