Before the call to system the programm doesn't run yet, and the future PID unpredictable. After it is already finished, and the old PID useless.
And why do you want that anyway? Looks like an XY Problem to me.
And why would you spawn an ls process when you have opendir and readdir as well as glob or File::Find?
In reply to Re: Obtain the child process id in perl
by moritz
in thread Obtain the child process id in perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |