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


by Biker (Priest)
on Apr 04, 2002 at 15:57 UTC ( #156693=note: print w/replies, xml ) Need Help??

in reply to
in thread numbers

It doesn't automatically scale. You must write that code with the knowledge of what is the biggest number you will handle.

"Since this is just cosmetics, it is not detrimental if it fails."

My users beg to disagree. Numbers not formatted correctly when presented on our Intranet Web pages may have a very high economical impact, including failed trades, penalty fees and loss of reputation.

The right answer is here.

Replies are listed 'Best First'.
by Anonymous Monk on Feb 02, 2005 at 01:58 UTC
    What do you mean "Right answer"? There are many ways of doing things in perl. You don't have get snotty about it. Here is yet another way that is even more efficent then your "right answer", but not as efficent as my previous example:
    &commify($x);#Robust - Does all size numbers sub commify { local $_ = shift; 1 while s/(-?\d+)(\d{3})/$1,$2/; return $_; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://156693]
[erix]: I should lose some weight although I keep telling myself that I'm doing extra training by lugging it along
[erix]: I saw a common kingfisher and a couple of bullfinches
[erix]: bullfinch ( a male and a female )
erix learned the word 'portaging' not so long ago (from vikings lugging their ships from one river-system to another)
[choroba]: my best run so far
[erix]: I think they build a portaging installation for yachts here not so long ago - lemme google it
[erix]: choroba ah, you should have sprinted 7 s off that :)
[erix]: (but then there's always a next (im)possible goal)
Corion avoids running by starting on time
[choroba]: my phone showed me 1 hour 10 km which was my goal, it changed a bit after uploading to the website

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-05-24 12:46 GMT
Find Nodes?
    Voting Booth?