Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Rounding numbersby DrHyde (Prior) |
on Mar 25, 2014 at 11:23 UTC ( [id://1079662]=note: print w/replies, xml ) | Need Help?? |
As others have mentioned, printf and sprintf are the functions you want:
If you want to round *all* numbers being written to a file then you may want to write a wrapper around that so you don't have to provide the printf format all the time. One way to do that would be by writing a sub-class of Tie::FileHandle::Base or you could write something based on Tie::STDOUT.
In Section
Seekers of Perl Wisdom
|
|