in reply to qx and $!

$! is not necessarily an error. Sometimes code will try something and if it didn't work try something else. Loading executable files from different directories in a path is an example. You should test the return value from a function to see if it gave an error, not $!. If you want the return value from a child process then it's $? you need.