perl -e \'system (\"crontab1 -l\");print $?\'
returns -1 as expected (program crontab1 doesn\'t exist)
perl -e \'system (\"crontab1 -l|
If you tolerate using something other than system, there are easier solutions. For example, the results method in IPC::Run returns all exit codes of the chain.
system