Keep in mind that unless you are running on a hard real-time system, there are no guarantees on usleep. All it guarantees is that it will wait at least as long as the the argument. You might look into Time::Clock, which says it guarantees time to within nanoseconds.