in reply to Re^2: passing a variable from shell script to the main perl
in thread passing a variable from shell script to the main perl

How are you calling your shell script? Are you using system?

system("shell.sh");

Any changes that your shell.sh script makes to the %ENV will not stay after the system command is finished. Instead, simply have your shell.sh script echo some text that your perl script can capture when using backticks.

my $results = `shell.sh`; if ($results =~ /Hello World/) { print "tada!"; }
shell.sh
echo "Hello world";

Replies are listed 'Best First'.
Re^4: passing a variable from shell script to the main perl
by vbynagari (Initiate) on Apr 05, 2011 at 22:22 UTC
    <text>when I do this </test>  $xx=`sh $translationscript $filename $source_dir $file 2>&1`; <text> the value $xx has the log from the shell script and the STDOUT. Also, in the shell, I am checking for some errors and based on the error - I have a variable defined and I want that variable need in perl and then I will have to continue my script based upon the type of error I get from the shell. How do I do this? </text> thx