my $number - 1000000;
$number = commify($number);

sub commify {
   (my $num = shift) =~ s/\G(\d{1,3})(?=(?:\d\d\d)+(?:\.|$))/$1,/g; 
   return $num; 
}
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.