use strict; use warnings; use POSIX qw(ceil); use POSIX qw(floor); my $num = 11; $num =~ m/\d*(\d{1})/; my $check = $1; if($check < 5) { $num = ceil($num/5)*5; }else { $num = floor($num/5)*5; } print "\n $num \n\n";
In reply to Best way to round a number. by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |