in reply to return values

Have a look at exit. You are confusing return values from subroutines with the return value perl gives back to the operating system after it finished the execution. So exit; # or exit(0); exits your perl script and perl gives back 0 (=success). The same way for returning error: exit(1);

-- Hofmator