in reply to How do I add commas to a number?

See perlfaq5: How can I output my numbers with commas added?. In addition, that FAQ apparently used to include the following, contributed by Andrew Johnson, as well:
sub commify { my $input = shift; $input = reverse $input; $input =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return reverse $input; }