in reply to Calling bash functions inside perl script

Part of your problem here is that there is a standard UNIX command called "test" (at /usr/bin/test, according to your error message). If you name your shell script something else, you might get a better error.