use Win32::API; $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", [], N); $PID = $GetPID->Call();