The Perl Cookbook (Recipe 2.17) has just what you need:
my $number = 987654321; print commify($number); sub commify { my $text = reverse $_[0]; $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text }
Update: blakem is right. And besides, my answer is incomplete. For a more complete answer, look here.
In reply to Re: Separating big numbers with commas
by monkeygirl
in thread Separating big numbers with commas
by Legg83
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |