export system environment variables within PERL
Hi gurus,
I need to be able to set Linux's environment variable within a PERL script.
The Linux command to set environment variable is "export".
So I tried to set it using the system() command:
system('export ORACLE_SID = TEST');
But that did not seem to work, the script just continues to execute without
actually changing the environment variable.
Any help would be greatly appreciate!
Gordon
Re: export system environment variables within PERL
"hastenthunder" <hastenthunder [at] hotmail.com> wrote in message
news:eBI0d.1230$Ny6.2370 [at] mencken.net.nih.gov...
> Hi gurus,
>
> I need to be able to set Linux's environment variable within a PERL
script.
> The Linux command to set environment variable is "export".
> So I tried to set it using the system() command:
>
> system('export ORACLE_SID = TEST');
>
> But that did not seem to work, the script just continues to execute
without
> actually changing the environment variable.
>
> Any help would be greatly appreciate!
$ENV{ORACLE_SID} = 'TEST';
Re: export system environment variables within PERL
Try looking up ARGV you should find your answer there.
ARGV is used for environment variables, as well as command line arguments.
"hastenthunder" <hastenthunder [at] hotmail.com> wrote in message
news:eBI0d.1230$Ny6.2370 [at] mencken.net.nih.gov...
> Hi gurus,
>
> I need to be able to set Linux's environment variable within a PERL
script.
> The Linux command to set environment variable is "export".
> So I tried to set it using the system() command:
>
> system('export ORACLE_SID = TEST');
>
> But that did not seem to work, the script just continues to execute
without
> actually changing the environment variable.
>
> Any help would be greatly appreciate!
>
> Gordon
>
>
Re: export system environment variables within PERL
"Gary Yates" <yatesgary [at] qwest.net> wrote in message
news:aiue12-24k.ln1 [at] rowdy02.myhome.cxm...
> "hastenthunder" <hastenthunder [at] hotmail.com> wrote in message
> news:eBI0d.1230$Ny6.2370 [at] mencken.net.nih.gov...
> > Hi gurus,
> >
> > I need to be able to set Linux's environment variable within a PERL
> script.
> > The Linux command to set environment variable is "export".
> > So I tried to set it using the system() command:
> >
> > system('export ORACLE_SID = TEST');
> >
> > But that did not seem to work, the script just continues to execute
> without
> > actually changing the environment variable.
>
> Try looking up ARGV you should find your answer there.
>
> ARGV is used for environment variables, as well as command line arguments.
I'd love to see you give an example of using the ARGV array for environment
variables, because it's impossible.
Re: export system environment variables within PERL
Gary Yates wrote:
> Try looking up ARGV you should find your answer there.
>
> ARGV is used for environment variables, as well as command line arguments.
You're wrong there. (argv,argc,envp) != ARGV.
-Joe