Updated: Provided working code, which doesn't work for 28.5, as it rounds to 28. Please ignore my solution.
See sprintf and Does Perl have a round() function? What about ceil() and floor()? Trig functions?, eg:
use warnings; use strict; my $number = 28.5555; # round number to no decimal places. my $rounded = sprintf("%.0f", $number); print "$rounded\n";
HTH.
In reply to Re: Rounding a number?
by ghenry
in thread Rounding a number?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |