This code (which has been tested this time) will take a number like 1234567.89 and turn it into 1.234.567,89.
perl -le 'print scalar reverse join "", map { s/(\d{2})\./$1,\b/; s/^( +\d{1,3})$/\.$1/; $_ } (reverse sprintf("%.2f", shift)) =~ m/.{1,3}/g' + 1234567.89
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Print a number with grouping in a European style
by belg4mit (Prior) on Feb 08, 2003 at 19:08 UTC | |
by integral (Hermit) on Feb 08, 2003 at 19:33 UTC |
Back to
Cool Uses for Perl