SPUG: Request for feedback on file-size humanizing routine

Tim Maher/CONSULTIX tim at consultix-inc.com
Thu Sep 7 11:07:20 CDT 2000


On Thu, Sep 07, 2000 at 12:27:38AM -0700, Jeremy Devenport wrote:
> Just out of curiosity has anyone looked at Number::Format? It seems to do
> the same thing.
> 
> Jeremy

If you guys are talking about inserting commas in numbers, Recipe 2.17
of the Perl Cookbook shows how to do that in 3 lines of code, and here's
a slightly different, "pessimaly scrutable" version extracted from a
Perl FAQ:

            sub commify {
                local $_  = shift;
                1 while s/^(-?\d+)(\d{3})/$1,$2/;
                return $_;
            }

*========================================================================*
| Dr. Tim Maher, CEO, Consultix       (206) 781-UNIX/8649;  ask for FAX# | 
| Email: tim at consultix-inc.com        Web: http://www.consultix-inc.com  |
|Training- TIM MAHER: Unix, Perl  DAMIAN CONWAY: Adv. Perl, OOP, Parsing |
|CLASSES 9/11: Perl+Modules  10/9: Adv OO-Perl/Parsing  10/16: Int. Perl |
I========================================================================*

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list