$num = 123456789; $num = reverse $num; # reverse the number's digits $num =~ s/(\d{3})/$1,/g; # insert comma every 3 digits, from beginning $num = reverse $num; # Reverse the result $num =~ s/^\,//; # remove leading comma, if any
In reply to Re: How do I print a large integer with thousands separators?
by hanspoo
in thread How do I print a large integer with thousands separators?
by miblo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |