in reply to Answer: How do I add commas to a number?
in thread How do I add commas to a number?

Very inefficient! Use:
$commas=~ s/^(-?\d+)(\d{3})/$1,$2/;
One line does it all.

hawk@rthawk.com

Replies are listed 'Best First'.
Re: Re: Answer: How do I add commas to a number?
by Biker (Priest) on Dec 12, 2001 at 20:49 UTC

    What happens if your value is 1_000_000 ?

    "Livet är hårt" sa bonden.
    "Grymt" sa grisen...

    A reply falls below the community's threshold of quality. You may see it by logging in.