Hi Vikram,

You are not able to access the env variable coz it is not set as you have
wished.

Do like the following.

Set environment variable using export.

export HAI=hai

and print the from your perl script.

The above command sets the environment variable in your system EVN variables
and you can use the same env variable in all subshells.

This works.

Hth,

Regards,
PP.


-----Original Message-----
From: vikram vikram vikram [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 27, 2007 8:18 PM
To: beginners@perl.org
Subject: How to set environment variable

  
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

           Please help me out 

Thanks in advance 
Vikram


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to