http://www.perlmonks.org?node_id=11111500


in reply to Setting $0 clears /proc/PID/environ too

The problem is that the process name and /proc/PID/environ are actually windows into the address space of the process. The pointers that determine these windows are in the kernel and the program cannot update them, but you can change the data stored in the region they point to.

Does changing $0 destroy %ENV or does perl copy the environment out of the way before reusing the original environment block?