Help for this page

Select Code to Download


  1. or download this
    my $sep    = ',';
    my $number = '12345678.27';
    ...
      s/(\d{3})(?=\d)(?!\d*\.)/$1$sep/go;
      return scalar(reverse());
    }
    
  2. or download this
    Benchmark: timing 5000000 iterations of MakeThousands, Thousandformat.
    +..
    MakeThousands: -1 wallclock secs ( 0.06 usr +  0.00 sys =  0.06 CPU) @
    + 83333333.33/s (n=5000000)
    Thousandformat:  1 wallclock secs ( 0.12 usr +  0.00 sys =  0.12 CPU) 
    +@ 41666666.67/s (n=5000000)