Re: How to set environment variable
27 Sep 2007 14:47:42 -0000, vikram vikram vikram <vicky_brsh@xxxxxxxxxxxxxx>:
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 -M
Data::Dumper -e '$ENV{TEST}=1;print Dumper \%ENV'
this would print what you want.
but,
$ echo $TEST
will get nothing.
.
Relevant Pages
- Re: unsetenv in the shell
... i have a perl program that calls another application. ... application uses the value of certain environment variables during its ... system("unsetenv VAR1"); ... in a perl script. ... (comp.lang.perl.misc) - Re: environment variables in perl scripts
... Define a BEGIN block in your perl program. ... > perl script, something like: ... > environment variables are there and diag.txt shows ... > This communication is intended for the use of the ... (perl.dbi.users) - Cgi with GD grap, and displaying graphs
... I am trying to create a web page, which takes data from a file and builds a graph with GD, these are then saved as pictures, I then use the cgi script to call the pics using dynamically generated HTML page, using a system call to another perl script. ... When I do this, I get a 500 internal error and I've traced this down to a permissions problem, as the apache user doesn't have the permissions to write the pic's in the /var/www/html file. ... I get GD to display the graph with in the perl script and not right pic's but dynamically display them, rather than calling another script to display the HTML, using system "html_diplay.pl", essentially two scripts instead of one. ... (perl.beginners) - Re: Newbie question: most efficient way to search fields of this file
... is created by a perl script. ... I need to extract for a given column, example col4hdr, the ... corresponding value and store it for display. ... (comp.lang.perl.misc) - Re: How to set environment variable
... I am new to perl. ... I want to set environment variable in a perl script ... and want to display the contents of the environment variable in the command line after executing the script. ... exits so does you env setting you made. ... (perl.beginners) |
|