Re: perlfaq5: "How can I output my numbers with commas added?"

[email protected] ("A. Pagaltzis") Tue, 8 Mar 2005 00:35:01 +0100
Newsgroups perl.perlfaq.workers
Message-ID <20050307233501.GA17303@klangraum>
* _brian_d_foy <[email protected]> [2005-03-08 00:25]:
> > Maybe the following could be added to the FAQ, possibly as
> > the canonical example?
> > 
> >     sub commify {
> >         scalar reverse join ',',
> >         unpack '(A3)*',
> >         scalar reverse shift;
> >     }
> 
> [ .. snip .. ]
> 
> Although this is an interesting use of pack(), I don't want to
> add it to the answer since it is more complicated than the
> other answers but doesn't have as much value.

Yes; I only noticed that later. See the discussion[1] at Perlmonks.

[1] http://www.perlmonks.org/index.pl?node_id=435711

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;