Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Answer: How do I print a large integer with thousands separators?

by Anonymous Monk
on Aug 15, 2003 at 12:32 UTC ( #284131=categorized answer: print w/replies, xml ) Need Help??

Q&A > data formatting > How do I print a large integer with thousands separators? - Answer contributed by Anonymous Monk

my $number = '$12345678.90'; # dollars $_ = reverse $number; s/(\d{3})(?=\d)(?!\d*\.)/$1,/g; $number = reverse $_;

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2020-10-27 16:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (257 votes). Check out past polls.

    Notices?