sub round_up { my $num = shift || die "Please, specify target number!"; my $length = length($num); my $first = substr($num, 0, 1); if($length > 2) { my $rest = substr($num, 1); $num = $first.('0'x($length - 1)) + ((substr($rest, 0, 1) + 1).('0'x(length($rest) - 1))); } elsif($length == 2) { $num = (substr($num, 0, 1) + 1) . ('0'x($length-1)); } else { $num = 10; } return $num; }