I can't use any modules that aren't standard
in reply to How do you get the PID of an external process?
There's a standard module called Win32, and you might be able to make use of its GetCurrentProcessId() function.
Here's the documentation for that function:
Returns the process identifier of the current process. Until the
process terminates, the process identifier uniquely identifies the
process throughout the system.
The current process identifier is normally also available via the
predefined $$ variable. Under fork() emulation however $$ may
contain a pseudo-process identifier that is only meaningful to the
Perl kill(), wait() and waitpid() functions. The
Win32::GetCurrentProcessId() function will always return the regular
Windows process id, even when called from inside a pseudo-process.