Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: "Commifying" a number

by BlueBlazerRegular (Friar)
on Dec 12, 2002 at 21:45 UTC ( [id://219433]=note: print w/replies, xml ) Need Help??


in reply to "Commifying" a number

From the 'Perl Cookbook' (pages 64-65):

sub commify { my $text = reverse $_[0]; $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; }

Is this more efficient? Heck, I don't know, but since no one had mentioned it...

Pat

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found