How To Format The Number Of Decimal Places In Perl
erics, October 10th, 2011
1 2 |
my $number = 123.45; printf("%.3f", $number); |
Outputs: 123.450
1 2 |
my $number = 123.45; printf("%.3f", $number); |
Outputs: 123.450
To pad a number with leading zeros, up to a max of 5 places:
1 |
sprintf("%05d",$value); |