in reply to Re: Formatting a number
in thread Formatting a number

$ perl -le' my $number = 123456789; my $ct = 0; $number = join q{}, reverse map { ++$ct % 3 ? $_ : ( $_, q{,} ) } reverse split //, $number; print $number; ' ,123,456,789
Oops, You have an extra comma at the beginning.

Replies are listed 'Best First'.
Re^3: Formatting a number
by johngg (Canon) on Oct 16, 2006 at 21:49 UTC
    So, not only slow but wrong, damn!