in reply to Call shell script variables in perl
system runs a subprocess, and because a subprocess gets its own copy of the environment, you cannot set/modify an environment variable from within a subprocess such that it will be available to the parent process (your Perl script here). In other words, the new subprocess' environment is gone as soon as the process has ended, i.e. when system returns. Exporting won't help.
But you could print the variable's value to stdout in the shell script, and capture it in the Perl script (e.g. via backticks).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Call shell script variables in perl
by k_manimuthu (Monk) on Mar 21, 2011 at 11:30 UTC |