in reply to checking for existence of a file in perl
if (-x file.sh) [download]
For checking return code, see system.