RE: How to set environment variable



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:vicky_brsh@xxxxxxxxxxxxxx]
Sent: Thursday, September 27, 2007 8:18 PM
To: beginners@xxxxxxxx
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

.



Relevant Pages

  • Re: Mail-merging with Word, MySQL... and Perl?
    ... Alt+F9 to toggle off their display. ... connection to my MySQL database on my Linux box. ... Or if a couple has its anniversary listed, I'll want to format ... the Perl script directly (which would be written to generate that data in ...
    (microsoft.public.word.mailmerge.fields)
  • Re: displaying a message using perl code
    ... I'm trying to get it to display a message. ... perl script email.pl ... # Should notification be send? ... sub validate { ...
    (perl.beginners)
  • Re: Cyrillic web pages with Perl and MySQL
    ... > This is my simple Perl Script to display the database table on a web ... For some reason it does not display the Cyrillic words correctly: ... which is, I believe, the default PhpMyAdmin output charset, ... I'ld suggest to keep your charset in perl the same as in your html ...
    (comp.lang.perl.misc)
  • Re: Newbie question: most efficient way to search fields of this file
    ... is created by a perl script. ... are headers or labels. ... I need to extract for a given column, example col4hdr, the ... corresponding value and store it for display. ...
    (comp.lang.perl.misc)