From: Robert Citek <[EMAIL PROTECTED]>
> Hello all,
> 
> I want to format a number so that it has commas as a separator. 
> Here's the code I came up with:
> 
> my $num=12345678;
> print scalar reverse( join(",", grep( /./ ,split
> (/(...)/,reverse($num))))), "\n";
> 
> This works but was wondering if anyone might suggest a better method.
> 
> Regards,
> - Robert

use Interpolation
        commify => 'commify';

print "And the result is $commify{$num}\n";

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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

Reply via email to