I'm trying to run perl script through bash, and get the perl's exit value.
perl_script.pl
print "test1";
sub a{
my @array = ("a","b");
if ($#array ne -1){
return 1;
}
else {return 0;}
}
my $result=a(arg1,arg2);
exit $result;
bash.sh
VARIABLE_1=$("perl_script.pl" arg1 arg2)
RESULT=$?
The '$?' variable keeps returning 0, no matter the exit value is. Do you know another way to retrieve the perl exit value from bash?
Thanks in advance!