Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: "Commifying" a number

by Anonymous Monk
on Aug 13, 2009 at 14:47 UTC ( [id://788319]=note: print w/replies, xml ) Need Help??


in reply to Re^3: "Commifying" a number
in thread "Commifying" a number

Here is a version without using reverse function. sub commify { (my $number = shift) =~ s/\G(-?)(\d{1,3})(?=(?:\d\d\d)+(?:\.|$))/$1$2,/g; return $number; } Manikanthan Velayutham programmed to think BIG

Replies are listed 'Best First'.
Re^5: "Commifying" a number
by Anonymous Monk on Aug 13, 2009 at 14:56 UTC
    My earlier post did not appear properly.
    sub commify { (my $number = shift) =~ s/\G([+|-]?)(\d{1,3})(?=(?:\d\d\d)+(?:\.|$ +))/$1$2,/g; return $number; }
    Manikanthan Velayutham

    programmed to think BIG

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found