can't you set the environmental variables for the parent shell by running a script as a . or here file?
-----Original Message----- >From: Jeff Pang <[EMAIL PROTECTED]> >Sent: Sep 27, 2007 10:02 AM >To: vikram vikram vikram <[EMAIL PROTECTED]> >Cc: beginners@perl.org >Subject: Re: How to set environment variable > >27 Sep 2007 14:47:42 -0000, vikram vikram vikram <[EMAIL PROTECTED]>: >> >> Hi All, >> >> I am new to perl. I am using "Active Perl-5.8.8" >> >> I want to set environment variable in a perl script >> >> Ex - #!/usr/bin/perl >> $ENV{HAI} = "hai"; >> >> >> and want to display the contents of the environment >> variable in the command line after executing the script. >> >> But it is not displaying the contents if i give >> echo $HAI >> > >Hi, > >When you start to run a perl program,a separate process is >started,which is different from your current shell process.So you >can't set the environment variables from another process to the >current shell process. > >you can do a test, >$ perl -MData::Dumper -e '$ENV{TEST}=1;print Dumper \%ENV' >this would print what you want. >but, >$ echo $TEST >will get nothing. > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >http://learn.perl.org/ > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/