my $half_hour = $hour * 2 + int($min/30); my $num_bells = ($half_hour + 7) % 8 + 1;