in reply to sleeping for less than 1 second

You will want to have a look at the Time::HiRes module - This module exports alternate alarm, sleep and time methods which allow timing with a greater level of precision. Additionally, this module provides ualarm and usleep methods for providing such timing precision measured in microseconds.

See the man page for this module for examples of usage.