DESCRIPTION which returns the pathnames of the files (or links) which would be exe- cuted in the current environment, had its arguments been given as com- mands in a strictly POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the arguments. It does not canonicalize path names. #### $ echo $SHELL /bin/bash #### $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin $ which perl /usr/bin/perl $ perl -le 'print $];' 5.026001 $ /usr/bin/perl -le 'print $];' 5.026001 # Select another perl, and hide the # perl executable by renaming it $ mv ~/perl528-d/bin/perl ~/perl528-d/bin/perl_hide # Prepend the location of that # "hidden" perl to $PATH $ export PATH=~/perl528-d/bin:$PATH # That change to $PATH clears the cache, # so run a perl command that will again # set the cached perl to /usr/bin/perl. # The problem does not arise if this # step is omitted. $ perl -le 'print $];' 5.026001 # Make the hidden perl visible again $ mv ~/perl528-d/bin/perl_hide ~/perl528-d/bin/perl $ which perl /home/sisyphus/perl528-d/bin/perl $ /home/sisyphus/perl528-d/bin/perl -le 'print $];' 5.028000 $ perl -le 'print $];' 5.026001 #### $ perl -le 'print $];' 5.026001 $ export PATH=~/nonexistent:$PATH $ perl -le 'print $];' 5.028000