Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Alone, each of these work. Together, the number gets jumbled. Any idea as to why?
sub numfix { my $num = shift; 1 while $num =~ s/^([-+]?\d+)(\d{3})/$1,$2/; $num = sprintf("%.2f", $num); return $num; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: adding comma and two decimals
by monarch (Priest) on Nov 25, 2005 at 02:16 UTC | |
by kulls (Hermit) on Nov 25, 2005 at 04:17 UTC | |
by monarch (Priest) on Nov 25, 2005 at 02:18 UTC | |
by Anonymous Monk on Nov 25, 2005 at 02:20 UTC |