[Israel.pm] setenv in perl

Madani, Srikanth, VF-DE Srikanth.Madani at vodafone.com
Thu Sep 2 06:51:00 PDT 2004


Jason Elbaum wrote:
>You can access environment variables *within* a perl script by using the 
>%ENV hash, which contains all the system environment variables. However, 
>changes you make there will not affect the parent process.

True. When the script exits, this variable will no longer be available. 

So what you can do is call the subsequent program (which needs the 
updated/new environment variable value) from within (and after) the Perl 
script which sets it. 

If you really want to access the parent shell, see 2.8 of 
comp.unix.questions [as suggested by perldoc -q environment] at 
http://www.cs.uu.nl/wais/html/na-dir/unix-faq/faq/part2.html 


Cheers,
Srikanth Madani
Once we've got the bugs ironed out, we'll be running on flat bugs.




More information about the Perl mailing list