Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by shmem (Chancellor)
on Dec 28, 2019 at 00:46 UTC ( [id://11110676]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Printing large numbers with commas to show thousands groups.
in thread Printing large numbers with commas to show thousands groups.

Hell, yes. There's always somebody who did it better than I could ever do. But! From the OP:
To modify existing code, just change your printf's to cprintf's and add apostrophe's to the formats as needed. Less work than wrapping each argument with a subroutine call and changing each format to %s. It also helps keep things clear and readable.

So, my attempt was to provide a solution without shelling out printf. And done, without having to pull in another package and introducing object syntax.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^4: Printing large numbers with commas to show thousands groups.
by Anonymous Monk on Dec 30, 2019 at 18:54 UTC

    ...And done, without having to pull in another package and introducing object syntax.

    ;) sub printf { ... hide object syntax }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found