in reply to How can I create a new ENV in Perl

You will have to use the Windows API, and even then, the new environment variable will likely only be seen by processes created after that change. See the Windows documentation on Environment Variables.

The likely easiest way to set the variables through the registry is Win32::TieRegistry.

Replies are listed 'Best First'.
Re^2: How can I create a new ENV in Perl
by anaconda_wly (Scribe) on Apr 01, 2013 at 09:25 UTC
    Thanks for the quick/useful reply. I'll have a try. Thanks if any other replies.
Re^2: How can I create a new ENV in Perl
by BillKSmith (Monsignor) on Apr 01, 2013 at 12:48 UTC

    I doubt that it would help to set the variable directly in the registry. You need to change the registry the same way that the control panel does when it creates new variable. Good luck finding that.

    Bill

      In the MSDN article I conveniently linked, there is the following paragraph:

      Calling SetEnvironmentVariable has no effect on the system environment variables. To programmatically add or modify system environment variables, add them to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE message with lParam set to the string "Environment". This allows applications, such as the shell, to pick up your updates.

      From that, I would assume that no luck is needed in finding the appropriate place.