Hi -

> -----Original Message-----
> From: Christopher M Burger [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 28, 2003 10:51 AM
> To: [EMAIL PROTECTED]
> Subject: formating numbers.
> 
> 
> I have some numbers that I want to format into a 00,000.00 format.  Right
> now the numbers are link 00000.00 how do I get the commas in 
> there.  I also
> do not know how many commas I will need.  As the number may be 0000000.00
> thus it would need two.  
> 
> Appreciate any help.
> 
> Chris Burger
> 

A generalized 'commify' sub looks something like this:

sub commify
{
  my $nbr = reverse shift;
  $nbr =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
  return scalar reverse $nbr;
}

Just call it - baring typos, it should work.

Aloha => Beau;


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

Reply via email to