in reply to How to execute a Korn shell ". <some-file>" from within Perl

You seem to be misunderstanding two things.

  1. Perl starts a new shell each time you call system or use backticks.
  2. A child process cannot modify the environment of its parent process. (This is generally regarded as a good thing.)
Keep those two things in mind and you'll understand why lines like `export ORAENV_ASK ORACLE_SID ORACLE_HOME`; are completely useless. It simply doesn't make sense to start a shell, export some envariables (which haven't even been set), and then exit the shell.

You can use a method such as runrig suggested; run a child process and then copy the child's environment into perl's. Or you can just set perl's environment in the first place. If you can be sure your shell script won't contain anything but simple variable assignments, parsing it directly wouldn't be too difficult. (Be forewarned that you'll be forever limited in the complexity of the shell script though.)

Finally, you also should keep in mind that perl uses /bin/sh to execute commands in backticks or when you call system with a single argument that contains shell metacharacters. Unless /bin/sh is really a Korn shell in your environment you should be careful of compatibility issues.

-sauoq
"My two cents aren't worth a dime.";