This works for me
http://search.cpan.org/doc/WRW/Number-Format-1.44/Format.pm

use strict;
use warnings;
use Number::Format qw(:subs :vars);
$THOUSANDS_SEP   = '.';
$DECIMAL_POINT   = ',';
my @number = (123456789,123);
foreach my $number (@number) {
  print format_number($number) . "\n";
}

use Number::Format qw(:subs);
my @number = (123456789,123);
foreach my $number (@number) {
  print format_picture($number, '###,###,###,###') . "\n";
}

On Tue, 30 Jul 2002 15:12:30 +0800, [EMAIL PROTECTED] (Connie Chan)
wrote:

>my $num = 1000000; # or whatever integer;
>
>$num = reverse($num);
>$num =~ s/(\d{3})/$1,/g;
>chop $num if $num =~ /,$/;
>$num = reverse($num);
>
>print $num; 
>
>I have this script to make an integer with comma at every 3 digits, from right to 
>left.
>(What should this presentation way name actaully ?? ) Like 123456 will becomes 
>123,456.
>Is there anyway can making this simpler ? Can sprintf help ?
>
>Another question is that how can I use 16 digits long integer ? Any LongInt there ?
>
>Rgds,
>Connie


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to