robby123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
We have a configuration file from which we need to read and set some environment variables
if(open IPFH,"<$fname") { seek IPFH,0,0; while (! eof IPFH) { my $con=<IPFH>; chomp $con; my($variable,$value)=split '=',$con; chomp $variable; chomp $value; $ENV{"$variable"}=$value; }
The issue is that Environment variables are not being set when we do this way; however when we explicitly specify like this $ENV{'HOSTS'}=$value; it works.Is there a way to overcome this.
Thanks in advance Robby
20040902 Edit by Corion: Added formatting
Im new to perl.... I guess my earler posting was not clear...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Setting environment variables by reading them from a configuration file
by nimdokk (Vicar) on Sep 02, 2004 at 13:20 UTC | |
|
Re: Setting environment variables by reading them from a configuration file
by Crian (Curate) on Sep 02, 2004 at 10:06 UTC | |
|
Re: Setting environment variables by reading them from a configuration file
by PodMaster (Abbot) on Sep 02, 2004 at 10:08 UTC | |
by robby123 (Initiate) on Sep 02, 2004 at 11:13 UTC | |
by Eimi Metamorphoumai (Deacon) on Sep 02, 2004 at 14:55 UTC | |
|
Re: Setting environment variables by reading them from a configuration file
by Anonymous Monk on Sep 02, 2004 at 11:08 UTC | |
|
Re: Setting environment variables by reading them from a configuration file
by Anonymous Monk on Sep 02, 2004 at 11:35 UTC |