while ( SERVICE_START_PENDING != Win32::Daemon::State() && $count < 20 ) { $state = Win32::Daemon::State(); sleep ( 1 ); print "sleep " . $count . " state: " . $state . "\n"; $count = $count + 1 ; }