So when you call exec it overrides the current (child) program with the shell from /bin/sh which interprets the string for you, which in turns starts another perl script which prints a PID (which is not the same as the one you forked off originally).
Maybe your other system is smart enough to detect that it doesn't really need to spawn a shell, but can execvp directly the new perl process. I'd guess that you'll get the same result on both systems if you use the LIST form of exec instead.
In reply to Re: exec sometimes changes pid
by moritz
in thread exec sometimes changes pid
by doom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |