Here's a little Perl snippet which will place commas in any number string right where they belong:
sub commify
{
my $text = reverse $_[0];
$text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
return scalar reverse $text;
}
So for example, by calling commify("13245766") the value "13,245,766" will be returned.
All the little commas right exactly at the correct positions using a simple regular expression. Pretty amazing language that Perl is. Does it make sense?
how to convert "13,245,766" bach to number??
The answer is simple: "$text =~ s/,//g;" (hope this helps).