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

String::Sprintf - Custom overloading of sprintf
  • Comment on Re^2: Printing large numbers with commas to show thousands groups.

Replies are listed 'Best First'.
Re^3: Printing large numbers with commas to show thousands groups.
by shmem (Chancellor) on Dec 28, 2019 at 00:46 UTC
    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'

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

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