in reply to How to control no. of digits on exponent
The problem is there are 9 characters in the output instead of 8.
No truncation occurs if more characters are produced than requested.
>perl -E"say length sprintf '%5s', $ARGV[0];" abc 5 >perl -E"say length sprintf '%5s', $ARGV[0];" abcdefghi 9
how can I control the number of digits on the exponent so that it prints e-4 or e-04 rather than e-004?
s/e[+-]\K00// # e-4 s/e[+-]\K0// # e-04
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to control no. of digits on exponent
by mjscott2702 (Pilgrim) on Dec 31, 2010 at 09:51 UTC |