wp.jochen.hayek.name/blog-en

a backticked command in Perl resp. Shell – what about $? ?

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:

$h = $(ls foo);
print "=$?={$?}n";
Exit mobile version