Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by hanspoo (Initiate)
on Oct 26, 2004 at 23:44 UTC ( [id://402850]=note: print w/replies, xml ) Need Help??


in reply to How do I print a large integer with thousands separators?

$num = 123456789; $num = reverse $num; # reverse the number's digits $num =~ s/(\d{3})/$1,/g; # insert comma every 3 digits, from beginning $num = reverse $num; # Reverse the result $num =~ s/^\,//; # remove leading comma, if any

Replies are listed 'Best First'.
Re: Answer: How do I print a large integer with thousands separators?
by stevecomrie (Beadle) on Oct 27, 2004 at 12:18 UTC

Log In?
Username:
Password:

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

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

    No recent polls found