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
hastenthunder [ Sa, 11 September 2004 21:45 ] [ ID #18618 ]

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';
Tintin [ So, 12 September 2004 12:52 ] [ ID #18619 ]

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
>
>
Gary Yates [ Mo, 13 September 2004 00:15 ] [ ID #18621 ]

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.
Tintin [ Mo, 13 September 2004 11:08 ] [ ID #18623 ]

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
Joe Smith [ Di, 14 September 2004 10:17 ] [ ID #18626 ]
Perl » alt.perl » export system environment variables within PERL

Vorheriges Thema: buffer
Nächstes Thema: Re: HTTP Authentication IN perl blind to user