use Win32::Daemon; Win32::Daemon::StartService(); print "test"; Win32:Daemon::StopService();