You are viewing the version of this documentation from Perl 5.8.6. View the latest version

The process number of the Perl running this script. You should consider this variable read-only, although it will be altered across fork() calls. (Mnemonic: same as shells.)

Note for Linux users: on Linux, the C functions getpid() and getppid() return different values from different threads. In order to be portable, this behavior is not reflected by $$, whose value remains consistent across threads. If you want to call the underlying getpid(), you may use the CPAN module Linux::Pid.