I wrote a Perl script, and it returned 1 or 0 depending on whether it fails/succeeds. I had a .csh shell script that reads the return value.
The .csh command is this:
> setenv CHECKER `perl $BIN_DIR/sgRevisionChecker.pl`
if($CHECKER) then
do stuff
else
echo 'Successful Run'
exit
endif
However, the Perl script won't pass the correct value even when in the Perl script I say "exit 1" or "exit 0".
However, if within the Perl script I do this:
print "1";
exit 1;
Then my shell script gets the value. It seems to get the value if I print it, but I don't think this is robust, and I want to do it the right way. I have tried other solutions, but printing seems to be the only fix.
What is the correct way to return a value from Perl to a .csh script?