* Shaun Guth <[EMAIL PROTECTED]> [2002-07-18 15:58]:
> What about being able to change the number of digits per grouping?
> 
> The one use I can think of atm is for certain cryptographic methods
> that output lists of numbers in blocks of 5...

It's a good thing you guys weren't around when they were writing
perlfaq5... geez...

> big_number.commify(" ",5);

Of course, we aren;t commifying any more.

  [% big_number = "1234567898765432"; big_number.commify(" ", 5) %]
  1234 5678 9876 5432

Comes from this:

  sub commify {
      local $_  = shift;
      my $c = shift || ",";
      my $n = shift || 3;
      1 while s/^([-+]?\d+)(\d{$n})/$1$c$2/;
      return $_;
  }

(darren)

-- 
I cannot believe in a God who wants to be praised all the time.
    -- Friedrich Nietzche


Reply via email to