sub round_to_halves { return 0.5 * (int(2*$_[0])); } my $num = 1.6; print round_to_halves($num), "\n";