use Win32::API; Win32::API->Import("kernel32", "int GetCurrentProcessId()"); $PID = GetCurrentProcessId();