... Win32::Service::GetStatus("", $svc, \%statusHash); #if ($statusHash{"CurrentState"} =~ /4/){ print "$svc" . " is currently " . $statcodeHash{$statusHash{"CurrentState"}} . "\n"; #} if (Win32::Service::StopService('', $svc)) { sleep (3); Win32::Service::GetStatus("", $svc, \%statusHash); print "$svc" . " is currently " . $statcodeHash{$statusHash{"CurrentState"}} . "\n"; } else { print "Error ... $^E\n"; }