printf: zero pad after the decimal a given amount
- From: jidanni@xxxxxxxxxxx
- Date: Mon, 31 Mar 2008 04:09:27 +0800
Why is there no way to tell printf to zero pad like the right column:
0.1 :0.100
0.05 :0.050
0.03 :0.030
0.025 :0.025
0.02 :0.020
0.015 :0.015
0.0125 :0.0125
0.01 :0.010
0.009 :0.009
0.00625:0.00625
0.005 :0.005
The challenge: Change only the "WHAT?" below to produce the right
column above. Thanks.
use constant S => 100000;
for ( 10000, 5000, 3000, 2500, 2000, 1500, 1250, 1000, 900, 625, 500 ) {
printf "%-7g:WHAT?\n", $_ / S, $_ / S;
}
.
- Follow-Ups:
- Re: printf: zero pad after the decimal a given amount
- From: xhoster
- Re: printf: zero pad after the decimal a given amount
- From: Dr.Ruud
- Re: printf: zero pad after the decimal a given amount
- From: Paul Lalli
- Re: printf: zero pad after the decimal a given amount
- From: szr
- Re: printf: zero pad after the decimal a given amount
- From: John W. Krahn
- Re: printf: zero pad after the decimal a given amount
- Prev by Date: Re: Windows paths in glob
- Next by Date: Re: How to find this pattern by regular expression?
- Previous by thread: Windows paths in glob
- Next by thread: Re: printf: zero pad after the decimal a given amount
- Index(es):