in reply to formatting numbers
A simplistic version is:
use warnings; use strict; for (qw($100000000.00 $100.00 $1000.00)) { my $value = reverse $_; $value =~ s/(\d{3})(?=\d)/$1,/g; $value = reverse $value; print "$_ => $value\n"; }
Prints:
$100000000.00 => $100,000,000.00 $100.00 => $100.00 $1000.00 => $1,000.00
However that (as you can see) doesn't obey the convention that $1000.00 does not get a comma.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: formatting numbers
by Anonymous Monk on Nov 08, 2007 at 03:20 UTC | |
by GrandFather (Saint) on Nov 08, 2007 at 03:39 UTC |