Nishi Prafull wrote:
On 7/18/05, John W. Krahn <[EMAIL PROTECTED]> wrote:
Nishi Prafull wrote:
Hi:
Hello,
I need to run a script noted by $cmd1 from within perl but before that
i need to set the environment variable. how can i do it?
I tried
my $TEMPHOME = "/tmp";
system($cmd1);
But the script still complains the $TEMPHOME is not set.
Thanks.
You probably want (untested):
$ENV{ TEMPHOME } = '/tmp';
I ttied it inside the perl script, but does not seem to work.
I did a echo for $TEMPHOME but it was not set.
$ perl -wle 'no warnings "uninitialized"; print $ENV{TEMPHOME};
$ENV{TEMPHOME} = "/tmp"; print $ENV{TEMPHOME}; print `env | grep TEMP`'
/tmp
TEMPHOME=/tmp
as you can see, once you've set it via %ENV you can access the env
variable from a shell started from within the perl script.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>