There's more than one way to do things | |
PerlMonks |
Re: Environment Variable Settingby chrestomanci (Priest) |
on Apr 23, 2012 at 16:33 UTC ( [id://966639]=note: print w/replies, xml ) | Need Help?? |
On unix, child processes inherit the environment from their parent, but any changes they make are not propagated back to the parent when the child quits. Your csh script works because it runs in the same process as your shell, so changes made in it remain after the script exits. The usual way to create a perl script that modifies the environment is to have it emit a shell script on stdout, and then eval the script's output. eg: eval `perl set_my_env.pl`The perl script just prints a series of setenv NAME value lines.
In Section
Seekers of Perl Wisdom
|
|