Re: How to add commas to a number?
- From: noreply@xxxxxxxxx (Gunnar Hjalmarsson)
- Date: Wed, 28 Nov 2007 23:35:57 +0100
JerryP wrote:
use strict;
use warnings;
sub commify {
local($_) = shift;
1 while s/^(-?\d+)(\d{3})/$1,$2/;
return $_;
}
If I input these numbers:
6238.12
121150.98
104903.30
113569.26
40239.51
8733.55
I get :
6238.12
121150.98
104903.30
113569.26
40,239.51
8,733.55
Any ideas?
When you say that you "input" those numbers, exactly which code are you using to produce the above result?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.
- References:
- How to add commas to a number?
- From: JerryP
- How to add commas to a number?
- Prev by Date: Re: Extracting one record from multiple-records textfile
- Next by Date: Re: fixed list combinatorics
- Previous by thread: RE: How to add commas to a number?
- Next by thread: Variable division, assignment and sprintf in one line
- Index(es):
Relevant Pages
|