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


in reply to Persistent environment (Windows)

Is there a way to force calls to system() to use the same environment as the main Perl program?

I am confused. To me, your test shows that the calls to system() inherit the environment from the main Perl program, but that changes made to the environment inside the system() call do not propagate back into the Perl program's environment.

Dave Roth's book Win32 Perl Scripting, Chapter 6, has a section on 'Modifying the User Environment', which might be worth a glance. He shows how to set permanently e.g. $ENV{'MonkeyLikes'}, using his module Win32::AdminMisc - close, but different from what you want to do.

Rudif

PS. By an amazing coincidence, the Chapter 6 of Dave's book is available online at the above URL as a sample chapter.