PATH used by the commands launched with system is the same as in the perl script, accessible via $ENV{PATH} . This is the PATH that the perl script inherits from the program being called, unless you change it in the script.
What will bite you is probably that you configured your PATH in the wrong configuration file. Define it in ~/.profile , /etc/profile or another system-wide file, and not in a shell configuration file, such as .bashrc . See this question for some general information.
If you want to set the path manually inside the perl script, you can use something like
$ENV{PATH} = "/usr/local/bin:$ENV{PATH}" unless ":$ENV{PATH}:" =~ m~:/usr/local/bin:~;
but this is probably a bad idea: in most cases, your script should not change the path chosen by the user who runs this script.
If you have problems finding the right place to install PATH on your system after reading the question I'm connected with and the questions related to my answer, ask Unix and Linux and do not forget to specify the details of your operating system (distribution, version, etc.) .d.) and how you enter the system (this is a user question, not a programming question).
source share