On Wed, Jan 17, 2007 at 8:59AM, Oscar Gomez wrote:
> how can i export a variable from program perl to shell script through
> environment variable.

This is not really a DBI question, so you will have better luck
posting this type of question to perl-monks
(http://www.perlmonks.org/) or similar forum.

If you want to spawn a process from your Perl script and have that
have an altered environment, you can change the environment variable
in your Perl program and then call the program (using system, exec, or
backticks):

  $ENV{XYZ} = 1;
  system(...) == 0 or die "system call failed";

If you don't want the environment of the Perl script altered, you can
set the environment variable in the command:

  system("XYZ=1 && export XYZ && ...") == 0 or die "system call failed";

If you want the Perl program to alter the environment of the process
that executed it (a shell, cron, another script, etc.), that is not
possible.

-- 
David Dooling

Reply via email to