In the Shell $? reflects the exit code of the previously executed command.
h=$(ls foo) # supposing there is neither a file nor a directory by that name echo "=$?=>{$?}"
In Perl $? reflects the exit code … as well:
- http://perldoc.perl.org/perlvar.html : $CHILD_ERROR
$h = $(ls foo); print "=$?={$?}n";