use POSIX; POSIX::ceil(3.14) => 4 #向上取整 POSIX::floor(3.14) => 3 # 向下取整, 等同于 int(3.14)
use Math::Round; my $num = 45.4; my $round = Math::Round($num);