Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re: Re: Re: Separating big numbers with commas

by Anonymous Monk
on Sep 05, 2001 at 02:07 UTC ( [id://110179]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://110179]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found