in reply to Making money look nice

If I remember correctly its actually in the Number:: family.. I think.. Anywho whatever module I saw it in, it went something to the effect of..
push(@data, '189803943', '39203', '12938032'); for ( @data ) { print "commified: " . add_c($_) . "\n"; } sub add_c { my $n = shift; $n = '0' x ( length($n) % 3 == 2 ? 1 : 2 ) . $n if (length($n) % 3) +; $n =~ s/(...)/\1,/g; $n =~ s/(?:^0+,?|,$)//g; return($n); }
Produces:
commified: 189,803,943
commified: 39,203
commified: 12,938,032