or download this
Currently, on all platforms except MSWin32, all system calls (e.g., us
+ing system() or back-ticks) made from threads use the environment var
+iable settings from the main thread. In other words, changes made to
+%ENV in a thread will not be visible in system calls made by that thr
+ead.
...
system("FOO=$msg; echo \$FOO"); # Outputs 'hello' to STDOUT
On MSWin32, each thread maintains its own set of environment variables
+.