Take a gander at Number::Format. If I remember
correctly it does locale sensitive number formatting
including among other things inserting commas at thousand
boundaries.
Peter @ Berghold . Net
Sieze the cow! Bite the day!
Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.
Brewer of Belgian style Ales
| [reply] |
| [reply] [d/l] |
Thanks, all! The perldocfaq listed a regexp to use, so I don't have to install modules, etc. Thanks again.
-nipper
| [reply] |
nipper,
Welcome to the Monastery! this node from our Categorized Questions and Answers section seems to answer what you are looking for. I highly recommend reading the PerlMonks FAQ since there is a myriad of information and it can be a little overwhelming when you are first geting started.
Cheers - L~R | [reply] |
Thanks, all! The perlfaq5 listed a regexp to use, so I don't have to install modules, etc. Thanks again.
-nipper | [reply] |
try this
$num=25000
$num =~ s/0/\,0/;
yak | [reply] |
That will only work if the first zero to occur is exactly where the comma should go:
$ perl -e '$num=10; $num =~ s/0/\,0/; print $num,"\n";'
1,0
$ perl -e '$num=25500; $num =~ s/0/\,0/; print $num,"\n";'
255,00
$ perl -e '$num=250000000; $num =~ s/0/\,0/; print $num,"\n";'
25,0000000
| [reply] |