in reply to Find the PID of current program

Note, however, that the PIDs will eventually wrap at some point, i.e. there is a maximum. Something like 32_000, depending on your system.
If this is a potential problem, you might want something more sophisticated.
You could also review previous perlmonks discussions.

non-Perl: Andy Ford