$ENV{MY_VAR} = "test";

will set the env var MY_VAR 

-Venkat



-----Original Message-----
From: perl newbie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 3:22 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: setting and importing ENV from within PERL


I am trying to figure out if there is a way to :

a) set an ENV variable from within a perl script and
then print out it's value from within the same shell.

Here is the code that I am trying to use:

#!/usr/bin/perl -w
use strict;

#  set some environment variables.
 system(`setenv MY_VAR "test"`);

# print the value of MY_VAR
 print " value of my_var is : $ENV{MY_VAR}\n";

Here is the system output :

% perl test_system.pl 
sh: setenv:  not found
Use of uninitialized value at test_system.pl line 12.
 value of my_var is : 
(pdxcs242, aix 4.1) % 


Is there a way to do something like this ?

Thanks

PN





__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to