in reply to sleep(2.5)
sleep can only sleep for an integer amount of time. Essentially, anything you pass to sleep will seem as though you did sleep( int(###) );. So sleep( 2.5 ) will sleep for 2 seconds, not 2.5. There are two solutions: use select as davido says (select( undef, undef, undef, 2.5 )) or else pull in the Time::HiRes module to replace the sleep command with one that works with floating point sleep times:
use Time::HiRes qw( sleep ); sleep( 2.5 );
|
|---|