Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
As another thought for you...consider the use of functions in the POSIX module to specify exactly what you want.
Of interest: "ceil", "floor", "lround", "modf", "round", "trunc". Some of the these functions didn't appear until Perl 5.22. So the newer functions could be an issue if you have an old Perl. Also read the documentation carefully. Some of these functions return an actual integer. Some return a float with the fractional part set to zero. These functions should be pretty fast (at least they are in C). In some cases, it might be appropriate to call one of these functions to make it crystal clear to the reader your exact intent even though you might follow it with some kind of printf or sprintf. In reply to Re: Padding with sprintf changing number
by Marshall
|
|