in reply to Setting a path for a sub function

I a bit confused by what you mean. Chdir will change the current path in the current program (not the shell), which is not overly useful. Use opendir,readdir,closedir to do stuff within the directory. The chdir is meaningless. Perhaps you are also asking about permissions? (opening, reading, and closing) In this case you should use chmod. I believe you are getting something confused here- or I am confused- what is the purpose of chdir here? You can open the dir passed as the argument (fully qualified) and open, read, and close it without chdir.
AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.