in reply to Obtaining a return code

At least on a Unix box, system() will return the exit status of the system call:
$x = system("echo y"); $x = $x/255; #set $x to actual exit value $y = system("blahblah"); $y = $y/255; #set $y to actual exit value
results in $x set to 0 and $y set to 256 (as long as there's no executable called "blahblah" in $PATH).