in reply to Find the PID of current program

This is the section right out of the Perl documentation for $$. You can find it in perlvar.
$PROCESS_ID $PID $$ The process number of the Perl running this script. Yo +u should consider this variable read-only, although it will be a +ltered across fork() calls. (Mnemonic: same as shells.) Note for Linux users: on Linux, the C functions "getpid +()" and "getppid()" return different values from different thre +ads. In order to be portable, this behavior is not reflected by + $$, whose value remains consistent across threads. If you w +ant to call the underlying "getpid()", you may use the CPAN mo +dule "Linux::Pid".