in reply to Numbers with commas
And tachyon commify will work, but the one provided in the Perl Cookbook 2.17 is more efficent.#!/usr/bin/perl use warnings; use strict; my $num = 1_002_345; my $total = $num + 1000;
sub commify { my $text = reverse $_[0]; $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; }
|
|---|