http://qs321.pair.com?node_id=110179


in reply to Re: Re: Re: Separating big numbers with commas
in thread Separating big numbers with commas

Heh, add a couple more decimal places and it will fail (unless you consider commas after the decimal point to be allowable):

#!/usr/bin/perl -w use strict; my $number='12345.67890'; # with commas, should be: 12,345.67890 print "N=$number\n"; $number =~ s/(\d)(?=(\d{3})+(\D|$))/$1\,/g; print "N=$number\n";

Output:

N=12345.67890 N=12,345.67,890

Looks funky to me.