Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Printing large numbers with commas to show thousands groups.

by shmem (Chancellor)
on Dec 27, 2019 at 13:48 UTC ( [id://11110659]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    cprintf "There are at least %'d ways to do it!\n", 42e6;
    
  2. or download this
    printf "There are at least @{[commify('%d')]} ways to do it!\n", 42e6;
    
  3. or download this
    sub commify {
        local $_  = shift;
    ...
    <    -1000000>
    <   +1,234.50>
    There are at least 42,000,000 ways to do it!
    

Log In?
Username:
Password:

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

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

    No recent polls found