http://www.perlmonks.org?node_id=542636

gaspodethewonderdog has asked for the wisdom of the Perl Monks concerning the following question:

I've been trying to determine if it is possible to specify a shell or shell variables and parameters for perl. The issue that I have is that there are specific environment variables and parameters that need to be set in a .csh environment (ex. PATH). When using the backticks like `myscript` it is instantiating a new shell and applying any environmental variables from the .cshrc which is overwriting the needed environmental variables.

The underlying reason for doing this is that there are several commands such as cp, cd, uname, etc that I need to use alternate versions while using an NFS mounted file system that cannot handle several special cases such as hard/soft links in a UNIX style fashion, and special code needs to be called to handle these kinds of issues. Unfortunately when trying to use `cp` in perl I am getting the wrong version since the PATH is coming from the newly instantiated csh and not from the enviroment that perl is running in.

I believe that the standard practice to get csh to do a 'fast' login is to use the -f switch and then it will avoid loading up the .cshrc and thus wouldn't overwrite the currently setup environment and variables.

Is there any variable or parameter in perl that can be set to tell it for example to use "csh -f" for the enviroment, or perhaps set it to "ksh" or "bash" for the shell? I've tried looking through all the docs, and while I believe system called through a multi parameter mode would avoid the shell (and probably do what I want) it only returns a status code of the program run and not the actual contents. Having to pipe the output to a file and then reading that in is perhaps a bit more complicated than the intended fix.

Thanks in advance for any hints or clues that may help me out here!