in reply to Why is this exit code -1?

Note: system sets and returns $?, so $code and $? will always have the same value.

Note: When $? is -1, the program couldn't be executed, and the reason is found in $!.